s&box docs

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: null
  • args: 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 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 check
  • exactFullName: 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)

Properties

Showing 31 properties

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.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 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 string Sandbox.TypeDescription.Namespace { get; set; }

Namespace 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

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Reflection
Doc IDT:Sandbox.TypeDescription

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