Class PropertyAccessor<T, U>
A type containing utilities for accessing non-public properties of an object.
Inherited Members
Namespace: IPA.Utilities
Assembly: IPA.Loader.dll
Syntax
public static class PropertyAccessor<T, U>
Type Parameters
Name | Description |
---|---|
T | the type that the properties are on |
U | the type of the property to access |
Methods
| Improve this Doc View SourceGet(T, String)
Gets the value of the property identified by name
on obj
.
Declaration
public static U Get(T obj, string name)
Parameters
Type | Name | Description |
---|---|---|
T | obj | the instance to access |
String | name | the name of the property |
Returns
Type | Description |
---|---|
U | the value of the property |
Exceptions
Type | Condition |
---|---|
MissingMemberException | when the property does not exist |
See Also
| Improve this Doc View SourceGet(ref T, String)
Gets the value of the property identified by name
on obj
.
Declaration
public static U Get(ref T obj, string name)
Parameters
Type | Name | Description |
---|---|---|
T | obj | the instance to access |
String | name | the name of the property |
Returns
Type | Description |
---|---|
U | the value of the property |
Remarks
The only reason to use this over Get(T, String) is if you are using a value type because it avoids a copy.
Exceptions
Type | Condition |
---|---|
MissingMemberException | when the property does not exist |
See Also
| Improve this Doc View SourceGetGetter(String)
Gets a PropertyAccessor<T, U>.Getter for the property identified by name
.
Declaration
public static PropertyAccessor<T, U>.Getter GetGetter(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | the name of the property |
Returns
Type | Description |
---|---|
PropertyAccessor.Getter<> | a PropertyAccessor<T, U>.Getter that can access that property |
Exceptions
Type | Condition |
---|---|
MissingMemberException | when the property does not exist |
GetSetter(String)
Gets a PropertyAccessor<T, U>.Setter for the property identified by name
.
Declaration
public static PropertyAccessor<T, U>.Setter GetSetter(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | the name of the property |
Returns
Type | Description |
---|---|
PropertyAccessor.Setter<> | a PropertyAccessor<T, U>.Setter that can access that property |
Exceptions
Type | Condition |
---|---|
MissingMemberException | when the property does not exist |
Set(T, String, U)
Sets the value of the property identified by name
on obj
.
Declaration
public static void Set(T obj, string name, U val)
Parameters
Type | Name | Description |
---|---|---|
T | obj | the instance to access |
String | name | the name of the property |
U | val | the new value of the property |
Remarks
This overload cannot be safely used for value types. Use Set(ref T, String, U) instead.
Exceptions
Type | Condition |
---|---|
MissingMemberException | when the property does not exist |
See Also
| Improve this Doc View SourceSet(ref T, String, U)
Sets the value of the property identified by name
on obj
.
Declaration
public static void Set(ref T obj, string name, U val)
Parameters
Type | Name | Description |
---|---|---|
T | obj | the instance to access |
String | name | the name of the property |
U | val | the new value of the property |
Remarks
This overload must be used for value types.
Exceptions
Type | Condition |
---|---|
MissingMemberException | when the property does not exist |