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`.

objectTypeDescription
Namespace
Sandbox
Assembly
Sandbox.Reflection
Declaration
public sealed class Sandbox.TypeDescription

Methods16

Showing 16 methods

public T Create(object[] args = null)PUBLIC

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.

ParameterTypeDescription
args = nullobject[]
Returns:T

public T CreateGeneric(System.Type[] typeArgs = null, object[] args = null)PUBLIC

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.

ParameterTypeDescription
typeArgs = nullType[]
args = nullobject[]
Returns:T

public T GetAttribute(bool inherited = False)PUBLIC

Returns the first attribute of given type, if any are present.

ParameterTypeDescription
inherited = Falsebool
Returns:T

public System.Collections.Generic.IEnumerable`1<T> GetAttributes(bool inherited = False)PUBLIC

Returns all attributes of given type, if any are present.

ParameterTypeDescription
inherited = Falsebool
Returns:IEnumerable<T>

public Sandbox.MethodDescription GetMethod(string name)PUBLIC

Get a method by name (will not find static methods)

ParameterTypeDescription
namestring

public Sandbox.MethodDescription GetStaticMethod(string name)PUBLIC

Get a method by name (will not find static methods)

ParameterTypeDescription
namestring

public object GetStaticValue(string name)PUBLIC

Get value by field or property name, and which type the member is declared to store (will not find static members)

ParameterTypeDescription
namestring
Returns:object

public object GetValue(object instance, string name)PUBLIC

Get value by field or property name (will not find static members)

ParameterTypeDescription
instanceobject
namestring
Returns:object

public bool HasAttribute(bool inherited = True)PUBLIC

Returns true if the class has this attribute

ParameterTypeDescription
inherited = Truebool
Returns:bool

public bool HasTag(string tag)PUBLIC

True if we have this tag.

ParameterTypeDescription
tagstring
Returns:bool

public bool IsNamed(string name, bool exactFullName = False)PUBLIC

Returns true if this is named the passed name, either through classname, target class name or an alias

ParameterTypeDescription
namestringThe name to check
exactFullName = FalseboolIf true, only the exact full name or aliases will match.
Returns:bool

public System.Type MakeGenericType(System.Type[] inargs)PUBLIC

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.

ParameterTypeDescription
inargsType[]
Returns:Type

public bool SetStaticValue(string name, object value)PUBLIC

Set static value by field or property name

ParameterTypeDescription
namestring
valueobject
Returns:bool

public bool SetValue(object instance, string name, object value)PUBLIC

Set value by field or property name (will not set static members)

ParameterTypeDescription
instanceobject
namestring
valueobject
Returns:bool

Properties31

Showing 31 properties

public string[] Sandbox.TypeDescription.Aliases { get; set; }PUBLICGETSET

Returns:string[]

public string Sandbox.TypeDescription.ClassName { get; set; }PUBLICGETSET

A string representing this class name. Historically this was provided by [Library( classname )]. If no special name is provided, this will be type.Name.

Returns:string

public string Sandbox.TypeDescription.Description { get; set; }PUBLICGETSET

Returns:string

public string Sandbox.TypeDescription.FullName { get; set; }PUBLICGETSET

Full name of this type.

Returns:string

public System.Type[] Sandbox.TypeDescription.GenericArguments { get; set; }PUBLICGETSET

If we're a generic type this will return our generic parameters.

Returns:Type[]

public string Sandbox.TypeDescription.Group { get; set; }PUBLICGETSET

Returns:string

public string Sandbox.TypeDescription.Icon { get; set; }PUBLICGETSET

Returns:string

public int Sandbox.TypeDescription.Identity { get; set; }PUBLICGETSET

An integer that represents this type. Based off the class name.

Returns:int

public System.Type[] Sandbox.TypeDescription.Interfaces { get; set; }PUBLICGETSET

If we implement any interfaces they will be here

Returns:Type[]

public bool Sandbox.TypeDescription.IsAbstract { get; set; }PUBLICGETSET

Gets a value indicating whether the System.Type is abstract and must be overridden.

Returns:bool

public bool Sandbox.TypeDescription.IsClass { get; set; }PUBLICGETSET

True if the target type is a class

Returns:bool

public bool Sandbox.TypeDescription.IsEnum { get; set; }PUBLICGETSET

True if the target type is an enum

Returns:bool

public bool Sandbox.TypeDescription.IsGenericType { get; set; }PUBLICGETSET

True if we're a generic type

Returns:bool

public bool Sandbox.TypeDescription.IsInterface { get; set; }PUBLICGETSET

True if the target type is an interface

Returns:bool

public bool Sandbox.TypeDescription.IsStatic { get; set; }PUBLICGETSET

True if the target type is static

Returns:bool

public bool Sandbox.TypeDescription.IsValid { get; set; }PUBLICGETSET

Whether the class is valid or not, i.e. whether the type still exists.

Returns:bool

public bool Sandbox.TypeDescription.IsValueType { get; set; }PUBLICGETSET

True if the target type is a value

Returns:bool

public string Sandbox.TypeDescription.Name { get; set; }PUBLICGETSET

Name of this type.

Returns:string

public string Sandbox.TypeDescription.Namespace { get; set; }PUBLICGETSET

Namespace of this type.

Returns:string

public int Sandbox.TypeDescription.Order { get; set; }PUBLICGETSET

Returns:int

public string Sandbox.TypeDescription.SourceFile { get; set; }PUBLICGETSET

The file containing this member

Returns:string

public int Sandbox.TypeDescription.SourceLine { get; set; }PUBLICGETSET

The line number of this member

Returns:int

public string[] Sandbox.TypeDescription.Tags { get; set; }PUBLICGETSET

Tags are set via the [Tag] attribute

Returns:string[]

On this page

Methodspublic T Create(System.Object[] args = null)public T CreateGeneric(System.Type[] typeArgs = null, System.Object[] args = null)public T GetAttribute(System.Boolean inherited = False)public System.Collections.Generic.IEnumerable`1<T> GetAttributes(System.Boolean inherited = False)public Sandbox.MethodDescription GetMethod(System.String name)public Sandbox.PropertyDescription GetProperty(System.String name)public Sandbox.MethodDescription GetStaticMethod(System.String name)public Sandbox.PropertyDescription GetStaticProperty(System.String name)public System.Object GetStaticValue(System.String name)public System.Object GetValue(System.Object instance, System.String name)public System.Boolean HasAttribute(System.Boolean inherited = True)public System.Boolean HasTag(System.String tag)public System.Boolean IsNamed(System.String name, System.Boolean exactFullName = False)public System.Type MakeGenericType(System.Type[] inargs)public System.Boolean SetStaticValue(System.String name, System.Object value)public System.Boolean SetValue(System.Object instance, System.String name, System.Object value)Propertiespublic System.String[] Sandbox.TypeDescription.Aliases { get; set; }public Sandbox.TypeDescription Sandbox.TypeDescription.BaseType { get; set; }public System.String Sandbox.TypeDescription.ClassName { get; set; }public Sandbox.MemberDescription[] Sandbox.TypeDescription.DeclaredMembers { get; set; }public System.String Sandbox.TypeDescription.Description { get; set; }public Sandbox.FieldDescription[] Sandbox.TypeDescription.Fields { get; set; }public System.String Sandbox.TypeDescription.FullName { get; set; }public System.Type[] Sandbox.TypeDescription.GenericArguments { get; set; }public System.String Sandbox.TypeDescription.Group { get; set; }public System.String Sandbox.TypeDescription.Icon { get; set; }public System.Int32 Sandbox.TypeDescription.Identity { get; set; }public System.Type[] Sandbox.TypeDescription.Interfaces { get; set; }public System.Boolean Sandbox.TypeDescription.IsAbstract { get; set; }public System.Boolean Sandbox.TypeDescription.IsClass { get; set; }public System.Boolean Sandbox.TypeDescription.IsEnum { get; set; }public System.Boolean Sandbox.TypeDescription.IsGenericType { get; set; }public System.Boolean Sandbox.TypeDescription.IsInterface { get; set; }public System.Boolean Sandbox.TypeDescription.IsStatic { get; set; }public System.Boolean Sandbox.TypeDescription.IsValid { get; set; }public System.Boolean Sandbox.TypeDescription.IsValueType { get; set; }public Sandbox.MemberDescription[] Sandbox.TypeDescription.Members { get; set; }public Sandbox.MethodDescription[] Sandbox.TypeDescription.Methods { get; set; }public System.String Sandbox.TypeDescription.Name { get; set; }public System.String Sandbox.TypeDescription.Namespace { get; set; }public System.Int32 Sandbox.TypeDescription.Order { get; set; }public Sandbox.PropertyDescription[] Sandbox.TypeDescription.Properties { get; set; }public System.String Sandbox.TypeDescription.SourceFile { get; set; }public System.Int32 Sandbox.TypeDescription.SourceLine { get; set; }public System.String[] Sandbox.TypeDescription.Tags { get; set; }public System.Type Sandbox.TypeDescription.TargetType { get; set; }public System.String Sandbox.TypeDescription.Title { get; set; }Metadata