Class VBEnumType
Represents any Enum type.
public sealed record VBEnumType : VBType, IEquatable<VBType>, IVBMemberOwnerType, IEquatable<VBEnumType>
- Inheritance
-
VBEnumType
- Implements
- Inherited Members
- Extension Methods
Constructors
VBEnumType(Symbol, bool)
Represents any Enum type.
public VBEnumType(Symbol Symbol, bool IsHidden = false)
Parameters
VBEnumType(Symbol, IEnumerable<VBEnumConstMemberSymbol>?, bool)
public VBEnumType(Symbol symbol, IEnumerable<VBEnumConstMemberSymbol>? members = null, bool isHidden = false)
Parameters
symbolSymbolmembersIEnumerable<VBEnumConstMemberSymbol>isHiddenbool
Properties
DefaultValue
Gets the default value for this data type.
public override VBTypedValue DefaultValue { get; }
Property Value
Remarks
⚠️ Derived types must back the implementation of this property with a thread-safe private static readonly Lazy<T>.
Failure to do so would lock up the static context initialization of the StaticSymbol symbols.
Members
Gets the members of this type.
public ImmutableArray<VBTypeMemberSymbol> Members { get; init; }
Property Value
Symbol
public Symbol Symbol { get; init; }
Property Value
Methods
AsDeclaredType(VBType)
The declared type type gives a declaration whose As clause names it: Long for an enumeration (MS-VBAL
§5.2.3.4: "the meaning is the same as if the enum name was replaced with the declared type Long"), and any other type itself.
public static VBType AsDeclaredType(VBType type)
Parameters
typeVBTypeThe type an
Asclause names.
Returns
Remarks
So an enumeration and Long, or two enumerations, are the same declared type where two declared types are matched: an event handler's
parameters and its event's (§5.3.1.8), an implemented name declaration's and its interface member's (§5.3.1.9), and a ByRef parameter and
the variable it is given (§5.3.1.11), by a call or by a RaiseEvent (§5.4.2.20). An Integer and a Long are not. Only the type
itself is mapped, not an array's element type: an array of an enumeration is not an array of Long here.
CreateValue(IBindingHandle)
A value of an enumeration type is a Long (MS-VBAL §5.2.3.4): what a variable declared as the enumeration holds is stored as one.
public override VBTypedValue CreateValue(IBindingHandle handle)
Parameters
handleIBindingHandle
Returns
WithMembers(IEnumerable<VBTypeMemberSymbol>)
Gets a copy of this type with the specified members.
public IVBMemberOwnerType WithMembers(IEnumerable<VBTypeMemberSymbol> members)
Parameters
membersIEnumerable<VBTypeMemberSymbol>The members of the new type.