Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var nameOfExpression = SyntaxFactory.LocalDeclarationStatement(
SyntaxFactory.VariableDeclaration(
SyntaxFactory.PredefinedType(
SyntaxFactory.Token(
SyntaxKind.StringKeyword)))
.WithVariables(
SyntaxFactory.SingletonSeparatedList<VariableDeclaratorSyntax>(
SyntaxFactory.VariableDeclarator(
SyntaxFactory.Identifier(
@"result"))
.WithInitializer(
SyntaxFactory.EqualsValueClause(
SyntaxFactory.InvocationExpression(
SyntaxFactory.IdentifierName(
@"nameof"))
.WithArgumentList(
SyntaxFactory.ArgumentList(
SyntaxFactory.SingletonSeparatedList<ArgumentSyntax>(
SyntaxFactory.Argument(
SyntaxFactory.IdentifierName(
@"result"))))))))));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment