public static ParameterSyntax CreateWithAttribute(string attributeTypeName, string parameterTypeName, string parameterName) { if (attributeTypeName == null) { throw new ArgumentNullException(nameof(attributeTypeName)); } if (parameterTypeName == null) { throw new ArgumentNullException(nameof(parameterTypeName)); } if (parameterName == null) { throw new ArgumentNullException(nameof(parameterName)); } return(SyntaxFactory .Parameter(SyntaxFactory.Identifier(parameterName)) .WithAttributeLists( SyntaxFactory.SingletonList( SyntaxFactory.AttributeList( SyntaxFactory.SingletonSeparatedList( SyntaxAttributeFactory.Create(attributeTypeName))))) .WithType(SyntaxFactory.IdentifierName(parameterTypeName))); }
public static AttributeListSyntax Create(string attributeName) { if (attributeName == null) { throw new ArgumentNullException(nameof(attributeName)); } return(SyntaxFactory.AttributeList( SyntaxFactory.SingletonSeparatedList( SyntaxAttributeFactory.Create(attributeName)))); }
public static AttributeListSyntax CreateWithOneItemWithOneArgumentWithNameEquals(string attributeName, string argumentName, string argumentValue) { if (attributeName == null) { throw new ArgumentNullException(nameof(attributeName)); } return(SyntaxFactory.AttributeList( SyntaxFactory.SingletonSeparatedList( SyntaxAttributeFactory .Create(attributeName) .WithArgumentList( SyntaxAttributeArgumentListFactory.CreateWithOneItemWithNameEquals(argumentName, argumentValue))))); }