s&box docs
API ReferenceSandbox.Internal

public class Sandbox.Internal.TypeLibrary

Methods

Showing 49 methods

public T GetAttribute(System.Type t)

Get single attribute of type, from type

public Sandbox.EnumDescription GetEnumDescription(System.Type enumType)

Get a class describing the values of an enum

public System.Type[] GetGenericArguments(System.Type genericType)

Performs `System.Type.GetGenericArguments` with access control checks. Will throw if any arguments aren't in the whitelist.

Parameters

  • genericType: Constructed generic type to get the arguments of

public System.Collections.Generic.IReadOnlyList`1<Sandbox.TypeDescription> GetGenericTypes(System.Type type, System.Type[] types)

Get a list of types that implement this generic type

public Sandbox.MemberDescription GetMemberByIdent(int ident)

Find a `Sandbox.MemberDescription` by its `Sandbox.MemberDescription.Identity`

public System.Collections.Generic.IReadOnlyList`1<System.ValueTuple`2<Sandbox.MethodDescription,T>> GetMethodsWithAttribute(bool onlyStatic = True)

Find all methods with given attribute, optionally non static

Parameters

  • onlyStatic: Default: True

public Sandbox.PropertyDescription[] GetPropertyDescriptions(object obj, bool onlyOwn = False)

Get a list of properties on the target object. To do this we'll just call GetDescription( obj.GetType() ) and return .Properties. Will return an empty array if we can't access these properties.

Parameters

  • onlyOwn: Default: False

public object GetPropertyValue(object target, string name)

Try to get a value from a property on an object

public Sandbox.TypeDescription GetTypeByIdent(int ident)

Find a TypeDescription by name

public int GetTypeIdent(System.Type type)

Get hash of a type.

public bool HasAttribute(System.Type type)

Return true if this type contains this attribute

public bool SetProperty(object target, string name, object value)

Set a named property on given object. Will perform extra magic for string inputs and try to convert to target property type.

Parameters

  • target: The target object to set a named property on.
  • name: Name of the property to set.
  • value: Value for the property.

Returns

Whether the property was set or not.

Metadata

FieldValue
NamespaceSandbox.Internal
Typeclass
AssemblySandbox.Reflection
Doc IDT:Sandbox.Internal.TypeLibrary

On this page

Methodspublic System.Boolean CheckValidationAttributes(T obj, System.String[] errors)public System.Boolean CheckValidationAttributes(T obj)public System.Object Create(System.String name, System.Type targetType, System.Object[] args = null)public T Create(System.Int32 ident)public T Create(System.String name = null, System.Boolean complainOnMissing = True)public T Create(System.String name, System.Object[] args, System.Boolean complainOnMissing = True)public T Create(System.Type type, System.Object[] args = null)public Sandbox.SerializedProperty CreateProperty(System.String title, Sandbox.SerializedObject so, System.Attribute[] attributes = null, Sandbox.SerializedObject parent = null)public Sandbox.SerializedProperty CreateProperty(System.String title, System.Func`1<T> get, System.Action`1<T> set, System.Attribute[] attributes = null, Sandbox.SerializedObject parent = null)public System.Collections.Generic.IEnumerable`1<Sandbox.MethodDescription> FindStaticMethods(System.String methodName)public System.Collections.Generic.IEnumerable`1<Sandbox.MethodDescription> FindStaticMethods(System.String methodName)public T FromBytes(Sandbox.ByteStream bs)public T FromBytes(System.Byte[] data)public T FromBytes(System.ReadOnlySpan`1<System.Byte> data)public T GetAttribute(System.Type t)public System.Collections.Generic.IReadOnlyList`1<T> GetAttributes()public System.Collections.Generic.IReadOnlyList`1<T> GetAttributes(System.Type t)public Sandbox.EnumDescription GetEnumDescription(System.Type enumType)public System.Type[] GetGenericArguments(System.Type genericType)public System.Collections.Generic.IReadOnlyList`1<Sandbox.TypeDescription> GetGenericTypes(System.Type type, System.Type[] types)public System.Collections.Generic.IEnumerable`1<T> GetMemberAttributes()public System.Collections.Generic.IEnumerable`1<T> GetMemberAttributes(System.Boolean staticMembers)public Sandbox.MemberDescription GetMemberByIdent(System.Int32 ident)public System.Collections.Generic.IReadOnlyList`1<System.ValueTuple`2<Sandbox.MethodDescription,T>> GetMethodsWithAttribute(System.Boolean onlyStatic = True)public Sandbox.PropertyDescription[] GetPropertyDescriptions(System.Object obj, System.Boolean onlyOwn = False)public System.Object GetPropertyValue(System.Object target, System.String name)public Sandbox.SerializedObject GetSerializedObject(System.Func`1<System.Object> fetchTarget, Sandbox.TypeDescription typeDescription, Sandbox.SerializedProperty parent = null)public Sandbox.SerializedObject GetSerializedObject(System.Object target)public Sandbox.TypeDescription GetType(System.String name, System.Boolean exactFullName = False)public Sandbox.TypeDescription GetType(System.String name, System.Type baseType)public Sandbox.TypeDescription GetType(System.Type type, System.String name, System.Boolean preferAddonAssembly = False, System.Boolean exactFullName = False)public Sandbox.TypeDescription GetType(System.Type type)public Sandbox.TypeDescription GetType()public Sandbox.TypeDescription GetType(System.String name, System.Boolean preferAddonAssembly, System.Boolean exactFullName)public Sandbox.TypeDescription GetType(System.String name, System.Boolean preferAddonAssembly)public Sandbox.TypeDescription GetType(System.String name)public Sandbox.TypeDescription GetTypeByIdent(System.Int32 ident)public System.Int32 GetTypeIdent(System.Type type)public System.Collections.Generic.IEnumerable`1<Sandbox.TypeDescription> GetTypes()public System.Collections.Generic.IReadOnlyList`1<Sandbox.TypeDescription> GetTypes(System.Type type)public System.Collections.Generic.IReadOnlyList`1<Sandbox.TypeDescription> GetTypes()public System.Collections.Generic.IReadOnlyList`1<System.ValueTuple`2<Sandbox.TypeDescription,T>> GetTypesWithAttribute()public System.Collections.Generic.IReadOnlyList`1<System.ValueTuple`2<Sandbox.TypeDescription,T>> GetTypesWithAttribute(System.Boolean inherited)public System.Boolean HasAttribute(System.Type type)public System.Boolean SetProperty(System.Object target, System.String name, System.Object value)public System.Void ToBytes(T value, Sandbox.ByteStream bs)public System.Byte[] ToBytes(T value)public System.Boolean TryGetType(System.Type t, Sandbox.TypeDescription typeDescription)public System.Boolean TryGetType(Sandbox.TypeDescription typeDescription)Metadata