Mscr:System.Types.Object
The base type that all other classes and structs inherit from. You do not have to inherit from this class directly, it is implicitly handled by MarsScript.
Note that while structs normally can't inherit from classes, internal magic applies here. Note that certain operators will only function for classes, not structs. You also cannot cast a struct to an Object, for that you would need to implement a generic container.
Details
class System.Types.Object
| Aliased as: | object
|
Public Methods
GetType
type GetType()
| Returns: | System.Types.Type | The type of the Object. Note that this is RTTI-aware, so it will get the actual type of the object, even if it has been upcast. |
ToString
virtual string ToString()
| Returns: | System.Types.String | A string that represents the current Object |
ToString is specifically made to be overridden by other classes, so either check the documentation to see what the string will actually look like, or implement your own. The default implementation will just return the full name of the Objects class, or "null" if it is null.
Operators
operator! (Logical Not)
bool operator !(Object a)
Returns true if the Object is non-null, and false if it is null.
operator== (Equal)
bool operator ==(Object a, Object b)
Returns true if both operand `a` and operand `b` are the same Object.
operator!= (Not Equal)
bool operator !=(Object a, Object b)
Returns true if operand `a` and operand `b` are NOT the same Object.
Casting
Explicit casts
Explicit casts will NOT happen automatically, and must use either C-style casts ((int)Value) or C#-style casts (Value as int).
| Type | Additional Info |
|---|---|
| System.Types.Bool (bool) | true if the Object is non-null, false if it is null.
info: While this operator is explicit in most contexts, in an
if statement this cast is treated as implicit, to make null-checking class Objects easier. |
| System.Types.UInt32 (uint32) | Casts to a 32-bit integer representing the objects current Dataspace |