Namespace: | Sirenix.Utilities |
Assembly: | Sirenix.Utilities |
public static class EmitUtilities
This class is due for refactoring. Use at your own peril.
public static bool CanEmit { get; }
public static ValueGetter<InstanceType, FieldType> CreateInstanceFieldGetter<InstanceType, FieldType>(FieldInfo fieldInfo)
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a getter for. |
Sirenix.Utilities.ValueGetter<InstanceType, FieldType> | A delegate which gets the value of the given field. |
InstanceType | The type of the instance to get a value from. |
FieldType | The type of the field to get a value from. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static ValueSetter<InstanceType, FieldType> CreateInstanceFieldSetter<InstanceType, FieldType>(FieldInfo fieldInfo)
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a setter for. |
Sirenix.Utilities.ValueSetter<InstanceType, FieldType> | A delegate which sets the value of the given field. |
InstanceType | The type of the instance to set a value on. |
FieldType | The type of the field to set a value to. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static Action<InstanceType> CreateInstanceMethodCaller<InstanceType>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo | The method info instance which is used. |
System.Action<InstanceType> | A delegate which calls the method and returns the result, except it's hundreds of times faster than MethodInfo.Invoke. |
InstanceType | The type of the class which the method is on. |
public static Action<InstanceType, Arg1> CreateInstanceMethodCaller<InstanceType, Arg1>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo | The method info instance which is used. |
System.Action<InstanceType, Arg1> | A delegate which calls the method and returns the result, except it's hundreds of times faster than MethodInfo.Invoke. |
InstanceType | The type of the class which the method is on. |
Arg1 | The type of the argument with which to call the method. |
public static ValueGetter<InstanceType, PropType> CreateInstancePropertyGetter<InstanceType, PropType>(PropertyInfo propertyInfo)
System.Reflection.PropertyInfo | propertyInfo | The System.Reflection.PropertyInfo instance describing the property to create a getter for. |
Sirenix.Utilities.ValueGetter<InstanceType, PropType> | A delegate which gets the value of the given property. |
InstanceType | The type of the instance to get a value from. |
PropType | The type of the property to get a value from. |
System.ArgumentNullException | The propertyInfo parameter is null. |
public static ValueSetter<InstanceType, PropType> CreateInstancePropertySetter<InstanceType, PropType>(PropertyInfo propertyInfo)
System.Reflection.PropertyInfo | propertyInfo | The System.Reflection.PropertyInfo instance describing the property to create a setter for. |
Sirenix.Utilities.ValueSetter<InstanceType, PropType> | A delegate which sets the value of the given property. |
InstanceType | The type of the instance to set a value on. |
PropType | The type of the property to set a value to. |
System.ArgumentNullException | The propertyInfo parameter is null. |
public static Func<InstanceType, ReturnType> CreateMethodReturner<InstanceType, ReturnType>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo | The method info instance which is used. |
System.Func<InstanceType, ReturnType> | A delegate which calls the method and returns the result, except it's hundreds of times faster than MethodInfo.Invoke. |
InstanceType | The type of the class which the method is on. |
ReturnType | The type which is returned by the given method info. |
public static Func<FieldType> CreateStaticFieldGetter<FieldType>(FieldInfo fieldInfo)
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a getter for. |
System.Func<FieldType> | A delegate which gets the value of the given field. |
FieldType | The type of the field to get a value from. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static Action<FieldType> CreateStaticFieldSetter<FieldType>(FieldInfo fieldInfo)
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a setter for. |
System.Action<FieldType> | A delegate which sets the value of the given field. |
FieldType | The type of the field to set a value to. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static Action CreateStaticMethodCaller(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo | The method info instance which is used. |
System.Action | A delegate which calls the method and returns the result, except it's hundreds of times faster than MethodInfo.Invoke. |
public static Func<PropType> CreateStaticPropertyGetter<PropType>(PropertyInfo propertyInfo)
System.Reflection.PropertyInfo | propertyInfo | The System.Reflection.PropertyInfo instance describing the property to create a getter for. |
System.Func<PropType> | A delegate which gets the value of the given property. |
PropType | The type of the property to get a value from. |
System.ArgumentNullException | The propertyInfo parameter is null. |
public static Action<PropType> CreateStaticPropertySetter<PropType>(PropertyInfo propertyInfo)
System.Reflection.PropertyInfo | propertyInfo | The System.Reflection.PropertyInfo instance describing the property to create a setter for. |
System.Action<PropType> | A delegate which sets the value of the given property. |
PropType | The type of the property to set a value to. |
System.ArgumentNullException | The propertyInfo parameter is null. |
public static WeakValueGetter CreateWeakInstanceFieldGetter(Type instanceType, FieldInfo fieldInfo)
System.Type | instanceType | The System.Type of the instance to get a value from. |
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a getter for. |
Sirenix.Utilities.WeakValueGetter | A delegate which gets the value of the given field. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static WeakValueGetter<FieldType> CreateWeakInstanceFieldGetter<FieldType>(Type instanceType, FieldInfo fieldInfo)
System.Type | instanceType | The System.Type of the instance to get a value from. |
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a getter for. |
Sirenix.Utilities.WeakValueGetter<FieldType> | A delegate which gets the value of the given field. |
FieldType | The type of the field to get a value from. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static WeakValueSetter CreateWeakInstanceFieldSetter(Type instanceType, FieldInfo fieldInfo)
System.Type | instanceType | Type of the instance. |
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a setter for. |
Sirenix.Utilities.WeakValueSetter | A delegate which sets the value of the given field. |
System.ArgumentNullException | The fieldInfo parameter is null. |
System.ArgumentException | Field cannot be static. |
public static WeakValueSetter<FieldType> CreateWeakInstanceFieldSetter<FieldType>(Type instanceType, FieldInfo fieldInfo)
System.Type | instanceType | Type of the instance. |
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a setter for. |
Sirenix.Utilities.WeakValueSetter<FieldType> | A delegate which sets the value of the given field. |
FieldType | The type of the field to set a value to. |
System.ArgumentNullException | The fieldInfo parameter is null. |
System.ArgumentException | Field cannot be static. |
public static Action<object> CreateWeakInstanceMethodCaller(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo |
System.Action<System.Object> |
public static Action<object, TArg1> CreateWeakInstanceMethodCaller<TArg1>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo | The method info instance which is used. |
System.Action<System.Object, TArg1> | A delegate which calls the method and returns the result, except it's hundreds of times faster than MethodInfo.Invoke. |
TArg1 |
public static Func<object, TArg1, TResult> CreateWeakInstanceMethodCaller<TResult, TArg1>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo | The method info instance which is used. |
System.Func<System.Object, TArg1, TResult> | A delegate which calls the method and returns the result, except it's hundreds of times faster than MethodInfo.Invoke. |
TResult | The type of the result. |
TArg1 | The type of the first argument. |
System.ArgumentNullException | methodInfo |
System.ArgumentException | Given method ' + methodInfo.Name + ' is static when it has to be an instance method. or Given method ' + methodInfo.Name + ' must return type + typeof(TResult) + . or Given method ' + methodInfo.Name + ' must have exactly one parameter. or The first parameter of the method ' + methodInfo.Name + ' must be of type + typeof(TArg1) + . |
public static Func<object, TResult> CreateWeakInstanceMethodCallerFunc<TResult>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo |
System.Func<System.Object, TResult> |
TResult |
public static Func<object, TArg, TResult> CreateWeakInstanceMethodCallerFunc<TArg, TResult>(MethodInfo methodInfo)
System.Reflection.MethodInfo | methodInfo |
System.Func<System.Object, TArg, TResult> |
TArg | |
TResult |
public static WeakValueGetter CreateWeakInstancePropertyGetter(Type instanceType, PropertyInfo propertyInfo)
System.Type | instanceType | The System.Type of the instance to get a value from. |
System.Reflection.PropertyInfo | propertyInfo | The System.Reflection.FieldInfo instance describing the field to create a getter for. |
Sirenix.Utilities.WeakValueGetter | A delegate which gets the value of the given field. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static WeakValueSetter CreateWeakInstancePropertySetter(Type instanceType, PropertyInfo propertyInfo)
System.Type | instanceType | Type of the instance. |
System.Reflection.PropertyInfo | propertyInfo | The System.Reflection.PropertyInfo instance describing the property to create a setter for. |
Sirenix.Utilities.WeakValueSetter | A delegate which sets the value of the given field. |
System.ArgumentNullException | The fieldInfo parameter is null. |
System.ArgumentException | Property cannot be static. |
public static Func<object> CreateWeakStaticFieldGetter(FieldInfo fieldInfo)
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a getter for. |
System.Func<System.Object> | A delegate which gets the value of the given field. |
System.ArgumentNullException | The fieldInfo parameter is null. |
public static Action<object> CreateWeakStaticFieldSetter(FieldInfo fieldInfo)
System.Reflection.FieldInfo | fieldInfo | The System.Reflection.FieldInfo instance describing the field to create a setter for. |
System.Action<System.Object> | A delegate which sets the value of the given field. |
System.ArgumentNullException | The fieldInfo parameter is null. |