public static ClassDeclarationSyntax CreateAsPublicStatic(string classTypeName) { if (classTypeName == null) { throw new ArgumentNullException(nameof(classTypeName)); } return(SyntaxFactory.ClassDeclaration(classTypeName) .AddModifiers(SyntaxTokenFactory.PublicKeyword(), SyntaxTokenFactory.StaticKeyword())); }
public static InterfaceDeclarationSyntax Create(string interfaceTypeName) { if (interfaceTypeName == null) { throw new ArgumentNullException(nameof(interfaceTypeName)); } return(SyntaxFactory.InterfaceDeclaration(interfaceTypeName) .AddModifiers(SyntaxTokenFactory.PublicKeyword())); }
public static ClassDeclarationSyntax CreateWithInheritClassType(string classTypeName, string inheritClassTypeName) { if (classTypeName == null) { throw new ArgumentNullException(nameof(classTypeName)); } return(SyntaxFactory.ClassDeclaration(classTypeName) .AddModifiers(SyntaxTokenFactory.PublicKeyword()) .AddBaseListTypes(SyntaxFactory.SimpleBaseType(SyntaxFactory.ParseTypeName(inheritClassTypeName)))); }
public static SyntaxTokenList PublicKeyword(bool withLeadingLineFeed = false, bool withTrailingSpace = true) { if (withLeadingLineFeed) { return(SyntaxFactory.TokenList( SyntaxTokenFactory.CarriageReturnLineFeed(), SyntaxTokenFactory.PublicKeyword(withTrailingSpace))); } return(SyntaxFactory.TokenList( SyntaxTokenFactory.PublicKeyword(withTrailingSpace))); }
public static ClassDeclarationSyntax CreateWithInterface(string classTypeName, string interfaceTypeName) { if (classTypeName == null) { throw new ArgumentNullException(nameof(classTypeName)); } return(SyntaxFactory.ClassDeclaration(classTypeName) .AddModifiers(SyntaxTokenFactory.PublicKeyword()) .WithBaseList( SyntaxFactory.BaseList( SyntaxFactory.SingletonSeparatedList <BaseTypeSyntax>( SyntaxFactory.SimpleBaseType( SyntaxFactory.IdentifierName(interfaceTypeName)))))); }
public static ClassDeclarationSyntax CreateWithInheritClassAndInterface(string classTypeName, string inheritClassTypeName, string interfaceTypeName) { if (classTypeName == null) { throw new ArgumentNullException(nameof(classTypeName)); } if (inheritClassTypeName == null) { throw new ArgumentNullException(nameof(inheritClassTypeName)); } if (interfaceTypeName == null) { throw new ArgumentNullException(nameof(interfaceTypeName)); } return(SyntaxFactory.ClassDeclaration(classTypeName) .AddModifiers(SyntaxTokenFactory.PublicKeyword()) .WithBaseList(SyntaxBaseListFactory.CreateTwoSimpleBaseTypes(inheritClassTypeName, interfaceTypeName))); }