Show / Hide Table of Contents

# Class PropertyAccessor<T, U>

A type containing utilities for accessing non-public properties of an object.

##### Inheritance

Object
PropertyAccessor<T, U>

##### Inherited Members

Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

###### 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 Source

#### Get(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 | if the property does not exist

##### See Also

Get(ref T, String)
GetGetter(String)
| Improve this Doc View Source

#### Get(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 | if the property does not exist

##### See Also

Get(T, String)
GetGetter(String)
| Improve this Doc View Source

#### GetGetter(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 | if the property does not exist

| Improve this Doc View Source

#### 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 | if the property does not exist

| Improve this Doc View Source

#### 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 | if the property does not exist

##### See Also

Set(ref T, String, U)
GetSetter(String)
| Improve this Doc View Source

#### Set(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 | if the property does not exist

##### See Also

Set(T, String, U)
GetSetter(String)