예제 #1
0
        private static string FormatNamespaceOrTypeSymbol(INamespaceOrTypeSymbol symbol)
        {
            var displayString = symbol.ToDisplayString(TypeFormat);

            if (symbol is ITypeSymbol type && type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T)
            {
                return("System.Nullable`1");
            }

            if (symbol.GetTypeArguments().Any())
            {
                return($"{displayString}`{symbol.GetTypeArguments().Length}");
            }

            return(displayString);
        }
        private string FormatTypeOrNamespace(INamespaceOrTypeSymbol symbol)
        {
            var displayString = symbol.ToDisplayString(TypeFormat);

            var type = symbol as ITypeSymbol;

            if (type != null && type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T)
            {
                return("System.Nullable`1");
            }

            if (symbol.GetTypeArguments().Any())
            {
                return(string.Format("{0}`{1}", displayString, symbol.GetTypeArguments().Length));
            }

            return(displayString);
        }
        private string FormatTypeOrNamespace(INamespaceOrTypeSymbol symbol)
        {
            var displayString = symbol.ToDisplayString(TypeFormat);

            var type = symbol as ITypeSymbol;
            if (type != null && type.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T)
            {
                return "System.Nullable`1";
            }

            if (symbol.GetTypeArguments().Any())
            {
                return string.Format("{0}`{1}", displayString, symbol.GetTypeArguments().Length);
            }

            return displayString;
        }