ClassDeclaration Class
Represents a class declaration.
public class ClassDeclaration : ClassOrStructDeclarationExample
var cls = new ClassDeclaration("MyClass");
cls.Modifiers = Modifiers.Public;
cls.BaseType = typeof(object);
cls.Members.Add(new MethodDeclaration("MyMethod") { Statements = [] });
Assert.Equal("""
public class MyClass : object
{
void MyMethod()
{
}
}
""", cls.ToCsharpString());- Inheritance
ClassOrStructDeclarationClassDeclaration
Constructors
| Name | Description |
|---|---|
| ClassDeclaration() | |
| ClassDeclaration(string?) | Initializes a new instance of the ClassDeclaration class with the specified name. |
ClassDeclaration overloads
ClassDeclaration()
ClassDeclaration.cspublic ClassDeclaration()No documentation is available.
ClassDeclaration(string?)
ClassDeclaration.csInitializes a new instance of the ClassDeclaration class with the specified name.
public ClassDeclaration(string? name)Parameters
namestring?- The class name.
Properties
| Name | Description |
|---|---|
| BaseType | Gets or sets the base class type. |