TypeDescriptionclass
Describes a type. We use this class to wrap and return System.Type's that are safe to interact with. Returned by `Sandbox.Internal.TypeLibrary`.
Methods16
Showing 16 methods
public T Create(object[] args = null)
Create an instance of this class, return it as a T. If it can't be cast to a T we won't create it and will return null.
| Parameter | Type | Description |
|---|---|---|
| args = null | object[] | — |
T—public T CreateGeneric(System.Type[] typeArgs = null, object[] args = null)
Create an instance of this class using generic arguments We're going to assume you know what you're doing here and let it throw any exceptions it wants.
| Parameter | Type | Description |
|---|---|---|
| typeArgs = null | Type[] | — |
| args = null | object[] | — |
T—public T GetAttribute(bool inherited = False)
Returns the first attribute of given type, if any are present.
| Parameter | Type | Description |
|---|---|---|
| inherited = False | bool | — |
T—public System.Collections.Generic.IEnumerable`1<T> GetAttributes(bool inherited = False)
Returns all attributes of given type, if any are present.
| Parameter | Type | Description |
|---|---|---|
| inherited = False | bool | — |
IEnumerable<T>—public Sandbox.MethodDescription GetMethod(string name)
Get a method by name (will not find static methods)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public Sandbox.PropertyDescription GetProperty(string name)
Get property by name (will not find static properties)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public Sandbox.MethodDescription GetStaticMethod(string name)
Get a method by name (will not find static methods)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public Sandbox.PropertyDescription GetStaticProperty(string name)
Get static property by name
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public object GetStaticValue(string name)
Get value by field or property name, and which type the member is declared to store (will not find static members)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
object—public object GetValue(object instance, string name)
Get value by field or property name (will not find static members)
| Parameter | Type | Description |
|---|---|---|
| instance | object | — |
| name | string | — |
object—public bool HasAttribute(bool inherited = True)
Returns true if the class has this attribute
| Parameter | Type | Description |
|---|---|---|
| inherited = True | bool | — |
bool—public bool HasTag(string tag)
True if we have this tag.
| Parameter | Type | Description |
|---|---|---|
| tag | string | — |
bool—public bool IsNamed(string name, bool exactFullName = False)
Returns true if this is named the passed name, either through classname, target class name or an alias
| Parameter | Type | Description |
|---|---|---|
| name | string | The name to check |
| exactFullName = False | bool | If true, only the exact full name or aliases will match. |
bool—public System.Type MakeGenericType(System.Type[] inargs)
For generic type definitions, create a type by substituting the given types for each type parameter. Returns null if any of the type arguments violate the generic constraints.
| Parameter | Type | Description |
|---|---|---|
| inargs | Type[] | — |
public bool SetStaticValue(string name, object value)
Set static value by field or property name
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| value | object | — |
bool—public bool SetValue(object instance, string name, object value)
Set value by field or property name (will not set static members)
| Parameter | Type | Description |
|---|---|---|
| instance | object | — |
| name | string | — |
| value | object | — |
bool—No results match this filter.
Properties31
Showing 31 properties
public string[] Sandbox.TypeDescription.Aliases { get; set; }
string[]—public Sandbox.TypeDescription Sandbox.TypeDescription.BaseType { get; set; }
The base type. This can return null if the type isn't in the type library!
public string Sandbox.TypeDescription.ClassName { get; set; }
A string representing this class name. Historically this was provided by [Library( classname )]. If no special name is provided, this will be type.Name.
string—public Sandbox.MemberDescription[] Sandbox.TypeDescription.DeclaredMembers { get; set; }
Members (methods, properties, etc) declared by exactly this type, and not inherited.
public string Sandbox.TypeDescription.Description { get; set; }
string—public Sandbox.FieldDescription[] Sandbox.TypeDescription.Fields { get; set; }
All fields on this type.
public string Sandbox.TypeDescription.FullName { get; set; }
Full name of this type.
string—public System.Type[] Sandbox.TypeDescription.GenericArguments { get; set; }
If we're a generic type this will return our generic parameters.
public string Sandbox.TypeDescription.Group { get; set; }
string—public string Sandbox.TypeDescription.Icon { get; set; }
string—public int Sandbox.TypeDescription.Identity { get; set; }
An integer that represents this type. Based off the class name.
int—public System.Type[] Sandbox.TypeDescription.Interfaces { get; set; }
If we implement any interfaces they will be here
public bool Sandbox.TypeDescription.IsAbstract { get; set; }
Gets a value indicating whether the System.Type is abstract and must be overridden.
bool—public bool Sandbox.TypeDescription.IsClass { get; set; }
True if the target type is a class
bool—public bool Sandbox.TypeDescription.IsEnum { get; set; }
True if the target type is an enum
bool—public bool Sandbox.TypeDescription.IsGenericType { get; set; }
True if we're a generic type
bool—public bool Sandbox.TypeDescription.IsInterface { get; set; }
True if the target type is an interface
bool—public bool Sandbox.TypeDescription.IsStatic { get; set; }
True if the target type is static
bool—public bool Sandbox.TypeDescription.IsValid { get; set; }
Whether the class is valid or not, i.e. whether the type still exists.
bool—public bool Sandbox.TypeDescription.IsValueType { get; set; }
True if the target type is a value
bool—public Sandbox.MemberDescription[] Sandbox.TypeDescription.Members { get; set; }
All members (methods, properties, etc) of this type.
public Sandbox.MethodDescription[] Sandbox.TypeDescription.Methods { get; set; }
All methods of this type.
public string Sandbox.TypeDescription.Name { get; set; }
Name of this type.
string—public string Sandbox.TypeDescription.Namespace { get; set; }
Namespace of this type.
string—public int Sandbox.TypeDescription.Order { get; set; }
int—public Sandbox.PropertyDescription[] Sandbox.TypeDescription.Properties { get; set; }
All properties of this type.
public string Sandbox.TypeDescription.SourceFile { get; set; }
The file containing this member
string—public int Sandbox.TypeDescription.SourceLine { get; set; }
The line number of this member
int—public string[] Sandbox.TypeDescription.Tags { get; set; }
Tags are set via the [Tag] attribute
string[]—public System.Type Sandbox.TypeDescription.TargetType { get; set; }
The type this class describes.
public string Sandbox.TypeDescription.Title { get; set; }
string—No results match this filter.