class TypeLibrary
in global :: Sandbox . Internal
😔 No documentation found.
public object Create( string name, Type targetType, object[] args = null )
Create a type instance by name and is assignable to given type, with optional arguments for its constructor.
nameName of the type to create.targetTypeType "constraint", as in the type instance must be assignable to this given type.argsOptional arguments for the constructor of the selected type.
public IEnumerable<MethodDescription> FindStaticMethods( string methodName )
Find all static methods with given name.
public IEnumerable<MethodDescription> FindStaticMethods( string methodName )
Find all static methods with given name.
public 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.
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.
targetThe target object to set a named property on.nameName of the property to set.valueValue for the property.- Returns Whether the property was set or not.
public object GetPropertyValue( object target, string name )
Try to get a value from a property on an object
public int GetTypeIdent( Type type )
Get hash of a type.
public TypeDescription GetType( Type type )
Get the description for a specific type. This will return null if you don't have whitelist access to the type. For constructed generic types, this will give you the description of the generic type definition.
public IEnumerable<TypeDescription> GetGenericTypes( Type type, Type[] types )
Get a list of types that implement this generic type
public IEnumerable<TypeDescription> GetTypes( Type type )
Get descriptions for all types that derive from T
public TypeDescription GetType( Type type, string name, bool preferAddonAssembly = False )
Find a TypeDescription that derives from T by name, which can be an Alias etc. If preferAddonAssembly is true, then if there are conflicts we'll prefer types that are in addon code.
public bool TryGetType( Type t, ref TypeDescription typeDescription )
Find the description type
public TypeDescription GetType( string name )
Find a TypeDescription by name
public TypeDescription GetType( string name )
Find a TypeDescription by name
public TypeDescription GetTypeByIdent( int ident )
Find a TypeDescription by name
public MemberDescription GetMemberByIdent( int ident )
Find a by its
public TypeDescription GetType( string name, Type baseType )
Find a TypeDescription that derives from , by name
public Type[] GetGenericArguments( Type genericType )
Performs with access control checks. Will throw if any arguments aren't in the whitelist.
genericTypeConstructed generic type to get the arguments of
public SerializedObject GetSerializedObject( object target )
Get a SerializedObject version of this object
public EnumDescription GetEnumDescription( Type enumType )
Get a class describing the values of an enum
public SerializedObject GetSerializedObject( Func<object> fetchTarget, TypeDescription typeDescription, SerializedProperty parent = null )
😔 No documentation found.
public SerializedProperty CreateProperty( string title, Func<T> get, Action<T> set, Attribute[] attributes = null, SerializedObject parent = null )
😔 No documentation found.
public bool HasAttribute( Type type )
😔 No documentation found.
public bool TryGetType( ref TypeDescription typeDescription )
😔 No documentation found.
public TypeDescription GetType( )
😔 No documentation found.
public SerializedProperty CreateProperty( string title, SerializedObject so, Attribute[] attributes = null, SerializedObject parent = null )
😔 No documentation found.
public IEnumerable<TypeDescription> GetTypes( )
😔 No documentation found.
public Type GetType( )
😔 No documentation found.
public string ToString( )
😔 No documentation found.
public bool CheckValidationAttributes( T obj )
😔 No documentation found.
public IEnumerable<TypeDescription> GetTypes( )
😔 No documentation found.
public int GetHashCode( )
😔 No documentation found.
public IEnumerable<T> GetAttributes( )
😔 No documentation found.
public IEnumerable<ValueTuple<TypeDescription,T>> GetTypesWithAttribute( )
😔 No documentation found.
public IEnumerable<ValueTuple<TypeDescription,T>> GetTypesWithAttribute( bool inherited )
😔 No documentation found.
public T GetAttribute( Type t )
😔 No documentation found.
public IEnumerable<T> GetAttributes( Type t )
😔 No documentation found.
public T Create( Type type, object[] args = null )
😔 No documentation found.
public T Create( string name = null, bool complainOnMissing = True )
😔 No documentation found.
public T Create( string name, object[] args, bool complainOnMissing = True )
😔 No documentation found.
public T Create( int ident )
😔 No documentation found.
public IEnumerable<ValueTuple<MethodDescription,T>> GetMethodsWithAttribute( )
😔 No documentation found.
public IEnumerable<ValueTuple<MethodDescription,T>> GetMethodsWithAttribute( bool onlyStatic )
😔 No documentation found.
public IEnumerable<T> GetMemberAttributes( )
😔 No documentation found.
public IEnumerable<T> GetMemberAttributes( bool staticMembers )
😔 No documentation found.
public byte[] ToBytes( T value )
😔 No documentation found.
public void ToBytes( T value, ref ByteStream bs )
😔 No documentation found.
public T FromBytes( byte[] data )
😔 No documentation found.
public T FromBytes( ReadOnlySpan<byte> data )
😔 No documentation found.
public T FromBytes( ref ByteStream bs )
😔 No documentation found.
public TypeDescription GetType( string name, bool preferAddonAssembly )
😔 No documentation found.
public bool Equals( object obj )
😔 No documentation found.