var myAttrArg = SyntaxFactory.AttributeArgument( SyntaxFactory.LiteralExpression( SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(42) ) );
var myStringAttrArg = SyntaxFactory.AttributeArgument( SyntaxFactory.LiteralExpression( SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal("Hello, world!") ) );This creates a new AttributeArgument with a value of "Hello, world!", wrapped in a StringLiteralExpression. This example uses the SyntaxFactory.Literal method to create a LiteralSyntax node representing the string literal. The SyntaxFactory.AttributeArgument class is part of the Microsoft.CodeAnalysis.CSharp.Syntax namespace, which is included in the Microsoft.CodeAnalysis.CSharp package.