StructDeclaration Class

Represents a struct declaration.

public class StructDeclaration : ClassOrStructDeclaration

Example

var str = new StructDeclaration("Point");
str.Members.Add(new FieldDeclaration("X", typeof(int)));
str.Members.Add(new FieldDeclaration("Y", typeof(int)));

Assert.Equal("""
    struct Point
    {
        int X;

        int Y;
    }

    """, str.ToCsharpString());
Inheritance
ClassOrStructDeclaration StructDeclaration

Constructors

NameDescription
StructDeclaration()
StructDeclaration(string?)Initializes a new instance of the StructDeclaration class with the specified name.

StructDeclaration overloads

StructDeclaration()

StructDeclaration.cs
public StructDeclaration()

No documentation is available.

StructDeclaration(string?)

StructDeclaration.cs

Initializes a new instance of the StructDeclaration class with the specified name.

public StructDeclaration(string? name)
Parameters
name string?
The struct name.