Class VBUserDefinedType
Represents any User-Defined Type (UDT) structure.
public record VBUserDefinedType : VBType, IEquatable<VBType>, IVBMemberOwnerType, IEquatable<VBUserDefinedType>
- Inheritance
-
VBUserDefinedType
- Implements
- Derived
- Inherited Members
Constructors
VBUserDefinedType(Symbol, ImmutableArray<VBTypeMemberSymbol>)
Represents any User-Defined Type (UDT) structure.
public VBUserDefinedType(Symbol Symbol, ImmutableArray<VBTypeMemberSymbol> Members)
Parameters
SymbolSymbolThe symbol associated with this UDT.
MembersImmutableArray<VBTypeMemberSymbol>The members (fields) of the UDT.
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
The members (fields) of the UDT.
public ImmutableArray<VBTypeMemberSymbol> Members { get; init; }
Property Value
Symbol
The symbol associated with this UDT.
public Symbol Symbol { get; init; }
Property Value
Methods
Equals(VBUserDefinedType?)
public virtual bool Equals(VBUserDefinedType? other)
Parameters
otherVBUserDefinedType
Returns
Remarks
Compares by the declaring symbol's Uri instead of the compiler-generated deep
structural comparison: Members can reference field symbols whose own
ResolvedType loops back to this very UDT, which the default record equality has no way
to guard against. Compares Uri.AbsoluteUri as an ordinal string rather than using
Uri's own Equals/GetHashCode: those deliberately ignore
Uri.Fragment, and a symbol's discriminating name/location is encoded entirely in the
fragment here — two distinct UDTs sharing a workspace root would otherwise compare equal.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
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.