Class VBType
A base abstract class representing any representable data type.
public abstract record VBType : IEquatable<VBType>
- Inheritance
-
VBType
- Implements
- Derived
- Inherited Members
Constructors
VBType(Type?, string, bool)
protected VBType(Type? managedType, string name, bool isHidden = false)
Parameters
Properties
DefaultValue
Gets the default value for this data type.
public abstract 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.
IsHidden
true for any implementation that has no specified semantics (internal types).
public bool IsHidden { get; init; }
Property Value
Remarks
These types are semantically hidden from user code, but still discoverable in the program memory space if they're allocated.
ManagedType
The underlying managed (.net) type that represents this VB type, if any.
[JsonIgnore]
public Type? ManagedType { get; init; }
Property Value
Remarks
👉 A runtime convenience, not serialized: an AST or symbol payload that crosses a process
boundary carries the type identity, and the receiving side resolves the singleton
VBType (and hence this) from it. Type is not JSON-serializable.
Name
The symbolic name of the type, as it is used in code.
public string Name { get; init; }
Property Value
Remarks
For module types, this value is determined by a VB_Name attribute.
Methods
CreateValue(IBindingHandle)
Creates a value of this type bound to handle.
public virtual VBTypedValue CreateValue(IBindingHandle handle)
Parameters
handleIBindingHandle
Returns
Remarks
The base implementation throws: only types that can hold a runtime value override this
(matches the intent of the removed VBTypedValueFactory.CreateValue(VBType) switch,
which returned null for the rest).
PrintMembers(StringBuilder)
Prints this VBType's members for ToString().
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
Remarks
Deliberately omits DefaultValue: every VBTypedValue carries its own
TypeInfo pointing back at the VBType that produced it, so printing
DefaultValue here and letting the compiler-generated ToString take its usual
course would recurse between the two PrintMembers implementations forever.