Class ReflectionUtils
Namespace: UnityEngine.Rendering.Tests
Syntax
public static class ReflectionUtils
Methods
FindTypeByName(String)
Finds a type by full name
Declaration
public static Type FindTypeByName(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The full type name with namespace |
Returns
Type | Description |
---|---|
Type | The found type |
GetField(Object, String)
Gets the value of a private field from a class
Declaration
public static object GetField(this object target, string fieldName)
Parameters
Type | Name | Description |
---|---|---|
Object | target | |
String | fieldName | The field to get |
Returns
Type | Description |
---|---|
Object |
GetFields(Object)
Gets all the fields from a class
Declaration
public static IEnumerable<FieldInfo> GetFields(this object target)
Parameters
Type | Name | Description |
---|---|---|
Object | target |
Returns
Type | Description |
---|---|
IEnumerable<FieldInfo> |
Invoke(Object, String, Object[])
Calls a private method from a class
Declaration
public static object Invoke(this object target, string methodName, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Object | target | |
String | methodName | The method name |
Object[] | args | The arguments to pass to the method |
Returns
Type | Description |
---|---|
Object |
InvokeStatic(Type, String, Object[])
Calls a private method from a class
Declaration
public static object InvokeStatic(this Type targetType, string methodName, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | targetType | |
String | methodName | The method name |
Object[] | args | The arguments to pass to the method |
Returns
Type | Description |
---|---|
Object |
SetField(Object, String, Object)
Sets a private field from a class
Declaration
public static void SetField(this object target, string fieldName, object value)
Parameters
Type | Name | Description |
---|---|---|
Object | target | |
String | fieldName | The field to change |
Object | value | The new value |