ExpressionSyntax NameOfSyntax(SyntaxToken identifier) { if (LanguageVersion.SupportsNameOf()) { return (InvocationExpression( IdentifierName("nameof"), ArgumentList( SingletonSeparatedList( Argument( IdentifierName(identifier) ))))); } return (LiteralExpression( SyntaxKind.StringLiteralExpression, Literal(identifier.Text) )); }