示例#1
0
            private IList <ISymbol> TypeArgumentSymbolsPresentInName(SimpleNameSyntax simpleName)
            {
                List <ISymbol> typeArgumentSymbols    = new List <ISymbol>();
                var            typeArgumentListSyntax = simpleName.DescendantNodesAndSelf().Where(n => n is TypeArgumentListSyntax);

                foreach (var typeArgumentList in typeArgumentListSyntax)
                {
                    var castedTypeArgument = (TypeArgumentListSyntax)typeArgumentList;
                    foreach (var typeArgument in castedTypeArgument.Arguments)
                    {
                        var symbol = _semanticModel.GetSymbolInfo(typeArgument).Symbol;
                        if (symbol != null && !typeArgumentSymbols.Contains(symbol))
                        {
                            typeArgumentSymbols.Add(symbol);
                        }
                    }
                }

                return(typeArgumentSymbols);
            }