当前位置: 首页>>代码示例>>C#>>正文


C# SymbolInfo类代码示例

本文整理汇总了C#中SymbolInfo的典型用法代码示例。如果您正苦于以下问题:C# SymbolInfo类的具体用法?C# SymbolInfo怎么用?C# SymbolInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SymbolInfo类属于命名空间,在下文中一共展示了SymbolInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Level2

 public Level2(Quote quote, SymbolInfo info)
 {
     this.CreatingTime = quote.CreatingTime;
     this.Symbol = quote.Symbol;
     this.Bids = Level2EntriesFromQuoteEntries(quote.Bids, info.RoundLot);
     this.Asks = Level2EntriesFromQuoteEntries(quote.Asks, info.RoundLot);
 }
开发者ID:ihalankou,项目名称:FdkUtilities,代码行数:7,代码来源:Level2.cs

示例2: TryClassifySymbol

        private bool TryClassifySymbol(
            NameSyntax name,
            SymbolInfo symbolInfo,
            SemanticModel semanticModel,
            CancellationToken cancellationToken,
            out IEnumerable<ClassifiedSpan> result)
        {
            if (symbolInfo.CandidateReason == CandidateReason.Ambiguous)
            {
                return TryClassifyAmbiguousSymbol(name, symbolInfo, semanticModel, cancellationToken, out result);
            }

            // Only classify if we get one good symbol back, or if it bound to a constructor symbol with
            // overload resolution/accessibility errors, or bound to type/constructor and type wasn't creatable.
            var symbol = TryGetSymbol(name, symbolInfo, semanticModel);

            ClassifiedSpan classifiedSpan;
            if (TryClassifySymbol(name, symbol, semanticModel, cancellationToken, out classifiedSpan))
            {
                result = SpecializedCollections.SingletonEnumerable(classifiedSpan);
                return true;
            }

            result = null;
            return false;
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:26,代码来源:NameSyntaxClassifier.cs

示例3: Resolve

        public override FlatOperand Resolve(ExpressionSyntax expression, ArgumentListSyntax argumentList, TypeInfo result_type, SymbolInfo si, FlatOperand into_lvalue, Function function, List<FlatStatement> instructions)
        {
            FlatOperand fop_subject;
            if (expression is IdentifierNameSyntax)
            {
                // typeof this
                fop_subject = FlatOperand.ThisRef(FlatValue.FromType(result_type.ConvertedType));
            }
            else if (expression is MemberAccessExpressionSyntax)
            {
                MemberAccessExpressionSyntax meas = (MemberAccessExpressionSyntax)expression;

                fop_subject = function.ResolveExpression(meas.Expression, null, instructions);
            }
            else
            {
                throw new NotImplementedException("GetMetaTable on expression type " + expression.GetType().ToString());
            }

            if (into_lvalue == null)
            {
                FlatOperand fop_register = function.AllocateRegister("");
                into_lvalue = fop_register.GetLValue(function, instructions);
            }
            instructions.Add(FlatStatement.GETMETATABLE(into_lvalue, fop_subject));
            return into_lvalue.AsRValue(FlatValue.Table());
        }
开发者ID:LaxLacks,项目名称:ls2csc,代码行数:27,代码来源:Intrinsics.cs

示例4: ToStaticMethodInvocation

        static SyntaxNode ToStaticMethodInvocation(SemanticModel model, InvocationExpressionSyntax invocation, MemberAccessExpressionSyntax memberAccess, SymbolInfo invocationRR)
        {
            var newArgumentList = invocation.ArgumentList.Arguments.ToList();
            newArgumentList.Insert(0, SyntaxFactory.Argument(memberAccess.Expression.WithoutLeadingTrivia()));

            var newTarget = memberAccess.WithExpression(SyntaxFactory.ParseTypeName(invocationRR.Symbol.ContainingType.ToMinimalDisplayString(model, memberAccess.SpanStart)));
            return SyntaxFactory.InvocationExpression(newTarget, SyntaxFactory.ArgumentList(SyntaxFactory.SeparatedList<ArgumentSyntax>(newArgumentList)));
        }
开发者ID:Kavignon,项目名称:RefactoringEssentials,代码行数:8,代码来源:InvokeAsStaticMethodCodeRefactoringProvider.cs

示例5: CalculatePriceBid

 public static double CalculatePriceBid(SymbolInfo symbol)
 {
     FinancialCalculator financialCalculator = FdkStatic.Calculator;
     double? rateK = financialCalculator.CalculateAssetRate(1, symbol.SettlementCurrency, "USD");
     if (!rateK.HasValue)
         return double.NaN;
     return rateK.Value;
 }
开发者ID:ihalankou,项目名称:rFdk,代码行数:8,代码来源:FdkSymbolInfo.cs

示例6: Main

        static void Main(string[] args)
        {
            string strConn = ConfigurationManager.ConnectionStrings["DBModel.Properties.Settings.StockDataConnectionString"].ConnectionString;

            List<SymbolInfo> symbolList = new List<SymbolInfo>();

            //Load Symbols From CSV
            using (StreamReader sr = File.OpenText(@"F:\Projects\Git\StockDownloader\LoadSymbol\ETF_List.csv"))
            {
                var line = sr.ReadLine();
                while(line != null)
                {
                    var items = line.Split(new char[] { ',' });

                    if(items.Length ==4)
                    {
                        var si = new SymbolInfo();

                        si.NativeSymbol = items[0];
                        si.Name = items[1];
                        si.Exchange = items[2];
                        si.NativeCountry = items[3];

                        if(si.IsValid())
                        {
                            symbolList.Add(si);
                        }
                    }

                    line = sr.ReadLine();
                }

                sr.Close();
            }

            using (StockDBDataContext dbContext = new StockDBDataContext(strConn))
            {
                foreach(var si in symbolList)
                {
                    var stockSymbol = dbContext.StockSymbols.Where(s => s.Symbol == si.Symbol).SingleOrDefault();

                    if(stockSymbol == null)
                    {
                        stockSymbol = new StockSymbol() { Symbol = si.Symbol, StockName = si.Name, Country = si.Country, ETF = si.ETF };
                        dbContext.StockSymbols.InsertOnSubmit(stockSymbol);

                    }
                    else
                    {
                        stockSymbol.StockName = si.Name;
                        stockSymbol.Country = si.Country;
                        stockSymbol.ETF = si.ETF;
                    }
                }

                dbContext.SubmitChanges();
            }
        }
开发者ID:henrylanca,项目名称:StockDownloader,代码行数:58,代码来源:Program.cs

示例7: Add

 public void Add(SymbolInfo symbol)
 {
     if (symbol is SymData32)
         Add(((SymData32)symbol).Name, symbol);
     else if (symbol is SymGProcRef)
         Add(((SymGProcRef)symbol).Name, symbol);
     else
         throw new ApplicationException("Invalid symbol type in call to GlobalsHash.Add(): " + symbol.ToString());
 }
开发者ID:0unit,项目名称:map2dbg,代码行数:9,代码来源:PdbUtils.cs

示例8: SymbolInfosAreCompatible

		public static bool SymbolInfosAreCompatible(SymbolInfo originalSymbolInfo, SymbolInfo newSymbolInfo, bool performEquivalenceCheck, bool requireNonNullSymbols = false)
		{
			try {
				return (bool)symbolInfosAreCompatibleMethod.Invoke (null, new object [] { originalSymbolInfo, newSymbolInfo, performEquivalenceCheck, requireNonNullSymbols });
			} catch (TargetInvocationException ex) {
				ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
				return false;
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:9,代码来源:SpeculationAnalyzer.cs

示例9: CalculatePipsValue

 public static double CalculatePipsValue(SymbolInfo symbol)
 {
     FinancialCalculator financialCalculator = FdkStatic.Calculator;
     int decimals = symbol.Precision;
     double contractSize = symbol.ContractMultiplier;
     double? rateK = financialCalculator.CalculateAssetRate(1, symbol.SettlementCurrency, "USD");
     if (!rateK.HasValue)
         throw new InvalidOperationException(
             string.Format("No rate for currency pair: {0}/USD", symbol.SettlementCurrency));
     double formula = Math.Pow(10, -decimals) * contractSize * rateK.Value;
     return formula;
 }
开发者ID:ihalankou,项目名称:rFdk,代码行数:12,代码来源:FdkSymbolInfo.cs

示例10: split_lists

		public static SymbolInfo split_lists(SymbolInfo si_left,SymbolInfo si_right)
		{
			if (si_left==null)
			{
				return si_right;
			}
			if (si_right==null)
			{
				return si_left;
			}
			SymbolInfo si=si_left;
			while(si.Next!=null)
			{
				si=si.Next;
			}
			si.Next=si_right;
			return si_left;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:18,代码来源:NVSymbolTable.cs

示例11: CanRewriteSymbol

        // we use the semantic model to get the type information of the method being called
        private static bool CanRewriteSymbol(SymbolInfo symbolInfo, out bool appendNewLine)
        {
            appendNewLine = false;
            IMethodSymbol methodSymbol = symbolInfo.Symbol as IMethodSymbol;
            if (methodSymbol == null) return false;

            switch (methodSymbol.Name)
            {
                case "AppendLine":
                case "Append":
                    if (methodSymbol.ContainingType.ToString() == "System.Text.StringBuilder")
                    {
                        appendNewLine = methodSymbol.Name == "AppendLine";
                        return true;
                    }
                    break;
            }
            return false;
        }
开发者ID:m0sa,项目名称:PrecompilationDemo,代码行数:20,代码来源:StringBuilderInterpolationOptimizer.cs

示例12: Resolve

        public override FlatOperand Resolve(InvocationExpressionSyntax node, TypeInfo result_type, SymbolInfo si, FlatOperand into_lvalue, Function function, List<FlatStatement> instructions)
        {
            if (!(node.Expression is MemberAccessExpressionSyntax))
            {
                throw new NotImplementedException("GETPROPERTY not on MemberAccessExpressionSyntax");
            }

            MemberAccessExpressionSyntax meas = (MemberAccessExpressionSyntax)node.Expression;

            FlatOperand fop_subject = function.ResolveExpression(meas.Expression, null, instructions);

            if (into_lvalue == null)
            {
                FlatOperand fop_register = function.AllocateRegister("");
                into_lvalue = fop_register.GetLValue(function, instructions);
            }
            instructions.Add(FlatStatement.STRINGVAL(into_lvalue, fop_subject));
            return into_lvalue.AsRValue(FlatValue.String(string.Empty));
        }
开发者ID:Noob536,项目名称:ls2csc,代码行数:19,代码来源:Intrinsics.cs

示例13: TryGetSymbol

        private static ISymbol TryGetSymbol(NameSyntax name, SymbolInfo symbolInfo, SemanticModel semanticModel)
        {
            if (symbolInfo.Symbol == null && symbolInfo.CandidateSymbols.Length > 0)
            {
                var firstSymbol = symbolInfo.CandidateSymbols[0];

                switch (symbolInfo.CandidateReason)
                {
                    case CandidateReason.NotAValue:
                        return firstSymbol;

                    case CandidateReason.NotCreatable:
                        // We want to color types even if they can't be constructed.
                        if (firstSymbol.IsConstructor() || firstSymbol is ITypeSymbol)
                        {
                            return firstSymbol;
                        }

                        break;

                    case CandidateReason.OverloadResolutionFailure:
                        // If we couldn't bind to a constructor, still classify the type.
                        if (firstSymbol.IsConstructor())
                        {
                            return firstSymbol;
                        }

                        break;

                    case CandidateReason.Inaccessible:
                        // If a constructor wasn't accessible, still classify the type if it's accessible.
                        if (firstSymbol.IsConstructor() && semanticModel.IsAccessible(name.SpanStart, firstSymbol.ContainingType))
                        {
                            return firstSymbol;
                        }

                        break;
                }
            }

            return symbolInfo.Symbol;
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:42,代码来源:NameSyntaxClassifier.cs

示例14: add_name

		public void add_name(string name,SymbolInfo si)
		{
			name=name_to_symtab(name);
			object o=ht[name];
			if (o==null)
			{
				SymbolInfoArrayList syal=new SymbolInfoArrayList();
				syal.Add(si);
				ht[name]=syal;
				return;
			}
			else
			{
				/*if (si.symbol_kind==symbol_kind.sk_none)
				{
					throw new CompilerInternalError("Duplicate name definition");
				}*/
				SymbolInfoArrayList syal1=(SymbolInfoArrayList)o;
				syal1.Add(si);
				return;
			}
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:22,代码来源:NVSymbolTable.cs

示例15: GetDelegatingConstructor

        public static IMethodSymbol GetDelegatingConstructor(
            SemanticDocument document,
            SymbolInfo symbolInfo,
            ISet<IMethodSymbol> candidateInstanceConstructors,
            INamedTypeSymbol containingType,
            IList<ITypeSymbol> parameterTypes)
        {
            var symbol = symbolInfo.Symbol as IMethodSymbol;
            if (symbol == null && symbolInfo.CandidateSymbols.Length == 1)
            {
                // Even though the symbol info has a non-viable candidate symbol, we are trying 
                // to speculate a base constructor invocation from a different position then 
                // where the invocation to it would be generated. Passed in candidateInstanceConstructors 
                // actually represent all accessible and invocable constructor symbols. So, we allow 
                // candidate symbol for inaccessible OR not creatable candidate reason if it is in 
                // the given candidateInstanceConstructors.
                //
                // Note: if we get either of these cases, we ensure that we can at least convert 
                // the parameter types we have to the constructor parameter types.  This way we
                // don't accidently think we delegate to a constructor in an abstract base class
                // when the parameter types don't match.
                if (symbolInfo.CandidateReason == CandidateReason.Inaccessible ||
                    (symbolInfo.CandidateReason == CandidateReason.NotCreatable && containingType.IsAbstract))
                {
                    var method = symbolInfo.CandidateSymbols.Single() as IMethodSymbol;
                    if (ParameterTypesMatch(document, parameterTypes, method))
                    {
                        symbol = method;
                    }
                }
            }

            if (symbol != null && candidateInstanceConstructors.Contains(symbol))
            {
                return symbol;
            }

            return null;
        }
开发者ID:hbarve1,项目名称:roslyn,代码行数:39,代码来源:GenerateConstructorHelpers.cs


注:本文中的SymbolInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。