Show / Hide Table of Contents

Class PropertyPointer

Provides factory methods for PropertyPointer<T>.

Inheritance
Object
PropertyPointer
Namespace: NanoByte.Common
Assembly: NanoByte.Common.dll
Syntax
public static class PropertyPointer : Object

Methods

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

Creates a property pointer.

Declaration
public static PropertyPointer<T> For<T>(Func<T> getValue, Action<T> setValue)
Parameters
Type Name Description
Func<T> getValue

A delegate that returns the current value.

Action<T> setValue

A delegate that sets the value.

Returns
Type Description
PropertyPointer<T>
Type Parameters
Name Description
T

The type of value the property contains.

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

Creates a property pointer.

Declaration
public static PropertyPointer<T> For<T>(Expression<Func<T>> expression)
Parameters
Type Name Description
Expression<Func<T>> expression

An expression pointing to the property.

Returns
Type Description
PropertyPointer<T>
Type Parameters
Name Description
T

The type of value the property contains.

Exceptions
Type Condition
ArgumentException

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

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

Creates a property pointer for a nullable value.

Declaration
public static PropertyPointer<T> ForNullable<T>(Func<T> getValue, Action<T> setValue)
Parameters
Type Name Description
Func<T> getValue

A delegate that returns the current value.

Action<T> setValue

A delegate that sets the value.

Returns
Type Description
PropertyPointer<T>
Type Parameters
Name Description
T

The type of value the property contains.

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

Creates a property pointer for a nullable value.

Declaration
public static PropertyPointer<T> ForNullable<T>(Expression<Func<T>> expression)
Parameters
Type Name Description
Expression<Func<T>> expression

An expression pointing to the property.

Returns
Type Description
PropertyPointer<T>
Type Parameters
Name Description
T

The type of value the property contains.

Exceptions
Type Condition
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.

Declaration
public static Action<T> ToSetValue<T>(this Expression<Func<T>> expression)
Parameters
Type Name Description
Expression<Func<T>> expression
Returns
Type Description
Action<T>
Type Parameters
Name Description
T
Exceptions
Type Condition
ArgumentException

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

In This Article
Back to top Copyright Bastian Eicher