Пример #1
0
        public static string GetNodeName([NotNull] this TypeSyntax node)
        {
            var nodeName = node.TryCast().Returning <string>()
                           // ReSharper disable PossibleNullReferenceException
                           .When <IdentifierNameSyntax>(syntax => syntax.Identifier.Text)
                           .When <QualifiedNameSyntax>(syntax => syntax.Right.Identifier.Text)
                           .When <PredefinedTypeSyntax>(syntax => syntax.Keyword.Text)
                           // ReSharper restore PossibleNullReferenceException
                           .Else(_ => null);

            return(nodeName);
        }