EnumerationDeclaration Class

Represents an enumeration declaration.

public class EnumerationDeclaration : TypeDeclaration

Example

var enumDecl = new EnumerationDeclaration("Status");
enumDecl.BaseType = typeof(int);
enumDecl.Members.Add(new EnumerationMember("Active", 1));
enumDecl.Members.Add(new EnumerationMember("Inactive", 2));

Assert.Equal("""
    enum Status : int
    {
        Active = 1,
        Inactive = 2
    }

    """, enumDecl.ToCsharpString());
Inheritance
TypeDeclaration EnumerationDeclaration

Constructors

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

EnumerationDeclaration overloads

EnumerationDeclaration()

EnumerationDeclaration.cs
public EnumerationDeclaration()

No documentation is available.

EnumerationDeclaration(string?)

EnumerationDeclaration.cs

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

public EnumerationDeclaration(string? name)
Parameters
name string?
The enumeration name.

Properties

NameDescription
BaseType
Members
public TypeReference? BaseType { get; set; }

Property value

TypeReference?

No documentation is available.

public CodeObjectCollection<EnumerationMember> Members { get; }

No documentation is available.