Table of Contents

Class PropertyPointer

Namespace
NanoByte.Common
Assembly
NanoByte.Common.dll

Provides factory methods for PropertyPointer<T>.

public static class PropertyPointer
Inheritance
object
PropertyPointer

Methods

ForNullable<T>(Func<T?>, Action<T?>)

Creates a property pointer for a nullable value.

public static PropertyPointer<T?> ForNullable<T>(Func<T?> getValue, Action<T?> setValue)

Parameters

getValue Func<T>

A delegate that returns the current value.

setValue Action<T>

A delegate that sets the value.

Returns

PropertyPointer<T>

Type Parameters

T

The type of value the property contains.

ForNullable<T>(Expression<Func<T?>>)

Creates a property pointer for a nullable value.

public static PropertyPointer<T?> ForNullable<T>(Expression<Func<T?>> expression)

Parameters

expression Expression<Func<T>>

An expression pointing to the property.

Returns

PropertyPointer<T>

Type Parameters

T

The type of value the property contains.

Exceptions

ArgumentException

The expression does not point to a property with a setter.

For<T>(Func<T>, Action<T>)

Creates a property pointer.

public static PropertyPointer<T> For<T>(Func<T> getValue, Action<T> setValue) where T : notnull

Parameters

getValue Func<T>

A delegate that returns the current value.

setValue Action<T>

A delegate that sets the value.

Returns

PropertyPointer<T>

Type Parameters

T

The type of value the property contains.

For<T>(Expression<Func<T>>)

Creates a property pointer.

public static PropertyPointer<T> For<T>(Expression<Func<T>> expression) where T : notnull

Parameters

expression Expression<Func<T>>

An expression pointing to the property.

Returns

PropertyPointer<T>

Type Parameters

T

The type of value the property contains.

Exceptions

ArgumentException

The expression does not point to a property with a setter.

ToSetValue<T>(Expression<Func<T>>)

Converts an expression pointing to a property into a delegate for setting the property's value.

public static Action<T> ToSetValue<T>(this Expression<Func<T>> expression)

Parameters

expression Expression<Func<T>>

Returns

Action<T>

Type Parameters

T

Exceptions

ArgumentException

The expression does not point to a property with a setter.