public static AttributeSyntax CreateWithOneItemWithOneArgument(string attributeName, int argumentValue) { if (attributeName == null) { throw new ArgumentNullException(nameof(attributeName)); } return(SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(RemoveSuffix(attributeName))) .WithArgumentList( SyntaxFactory.AttributeArgumentList( SyntaxFactory.SingletonSeparatedList( SyntaxAttributeArgumentFactory.Create(argumentValue))))); }
public static AttributeSyntax CreateWithOneItemWithTwoArgument(string attributeName, object argumentValue1, object argumentValue2) { if (attributeName == null) { throw new ArgumentNullException(nameof(attributeName)); } return(SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(RemoveSuffix(attributeName))) .WithArgumentList( SyntaxFactory.AttributeArgumentList( SyntaxFactory.SeparatedList <AttributeArgumentSyntax>( new SyntaxNodeOrToken[] { SyntaxAttributeArgumentFactory.Create(argumentValue1), SyntaxTokenFactory.Comma(), SyntaxAttributeArgumentFactory.Create(argumentValue2), })))); }
public static AttributeArgumentListSyntax CreateWithOneItemWithNameEquals(string attributeName, string attributeValue) { return(SyntaxFactory.AttributeArgumentList( SyntaxFactory.SingletonSeparatedList( SyntaxAttributeArgumentFactory.CreateWithNameEquals(attributeName, attributeValue)))); }