public sealed class Sandbox.TypeDescription
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`.
Methods
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.
Parameters
args: Default: null
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.
Parameters
typeArgs: Default: nullargs: Default: null
public T GetAttribute(bool inherited = False)
Returns the first attribute of given type, if any are present.
Parameters
inherited: Default: False
public System.Collections.Generic.IEnumerable`1<T> GetAttributes(bool inherited = False)
Returns all attributes of given type, if any are present.
Parameters
inherited: Default: False
public Sandbox.MethodDescription GetMethod(string name)
Get a method by name (will not find static methods)
public Sandbox.PropertyDescription GetProperty(string name)
Get property by name (will not find static properties)
public Sandbox.MethodDescription GetStaticMethod(string name)
Get a method by name (will not find static methods)
public Sandbox.PropertyDescription GetStaticProperty(string name)
Get static property by name
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)
public object GetValue(object instance, string name)
Get value by field or property name (will not find static members)
public bool HasAttribute(bool inherited = True)
Returns true if the class has this attribute
Parameters
inherited: Default: True
public bool HasTag(string tag)
True if we have this tag.
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
Parameters
name: The name to checkexactFullName: If true, only the exact full name or aliases will match. Default: False
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.
public bool SetStaticValue(string name, object value)
Set static value by field or property name
public bool SetValue(object instance, string name, object value)
Set value by field or property name (will not set static members)
No results match this filter.
Properties
Showing 31 properties
public string[] Sandbox.TypeDescription.Aliases { get; set; }
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.
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; }
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.
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; }
public string Sandbox.TypeDescription.Icon { get; set; }
public int Sandbox.TypeDescription.Identity { get; set; }
An integer that represents this type. Based off the class name.
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.
public bool Sandbox.TypeDescription.IsClass { get; set; }
True if the target type is a class
public bool Sandbox.TypeDescription.IsEnum { get; set; }
True if the target type is an enum
public bool Sandbox.TypeDescription.IsGenericType { get; set; }
True if we're a generic type
public bool Sandbox.TypeDescription.IsInterface { get; set; }
True if the target type is an interface
public bool Sandbox.TypeDescription.IsStatic { get; set; }
True if the target type is static
public bool Sandbox.TypeDescription.IsValid { get; set; }
Whether the class is valid or not, i.e. whether the type still exists.
public bool Sandbox.TypeDescription.IsValueType { get; set; }
True if the target type is a value
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.
public string Sandbox.TypeDescription.Namespace { get; set; }
Namespace of this type.
public int Sandbox.TypeDescription.Order { get; set; }
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
public int Sandbox.TypeDescription.SourceLine { get; set; }
The line number of this member
public string[] Sandbox.TypeDescription.Tags { get; set; }
Tags are set via the [Tag] attribute
public System.Type Sandbox.TypeDescription.TargetType { get; set; }
The type this class describes.
public string Sandbox.TypeDescription.Title { get; set; }
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox |
| Type | class |
| Assembly | Sandbox.Reflection |
| Doc ID | T:Sandbox.TypeDescription |