Class NullValue
Represents a null value in the virtual machine.
Implements
Inherited Members
Namespace: VM.Core.ValueTypes
Assembly: VM.dll
Syntax
public sealed class NullValue : IValue
Remarks
Implements the null object pattern for the VM's type system. All conversions return default/empty values.
Fields
Instance
The singleton instance of NullValue.
Declaration
public static readonly NullValue Instance
Field Value
Type | Description |
---|---|
NullValue |
Properties
Raw
Gets the raw underlying value as an object.
Declaration
public object Raw { get; }
Property Value
Type | Description |
---|---|
object |
TypeName
Gets the type name of this value.
Declaration
public string TypeName { get; }
Property Value
Type | Description |
---|---|
string |
Methods
AsBool()
Converts the value to a boolean.
Declaration
public bool AsBool()
Returns
Type | Description |
---|---|
bool | The boolean representation of the value. |
AsFloat()
Converts the value to a floating-point number.
Declaration
public float AsFloat()
Returns
Type | Description |
---|---|
float | The converted float value. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | Thrown when conversion is not possible. |
AsInt()
Converts the value to an integer.
Declaration
public int AsInt()
Returns
Type | Description |
---|---|
int | The converted integer value. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | Thrown when conversion is not possible. |
AsString()
Converts the value to a string.
Declaration
public string AsString()
Returns
Type | Description |
---|---|
string | The string representation of the value. |
ToString()
Returns the string "null".
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |