Table of Contents

Class PropertyPointer<T>

Namespace
NanoByte.Common
Assembly
NanoByte.Common.dll

Wraps delegate-based access to a property.

public class PropertyPointer<T> : MarshalByRefObject

Type Parameters

T

The type of value the property contains.

Inheritance
object
MarshalByRefObject
PropertyPointer<T>
Extension Methods

Constructors

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

Wraps delegate-based access to a property.

public PropertyPointer(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.

Properties

Value

Transparent access to the wrapper value.

public T Value { get; set; }

Property Value

T

Methods

SetTemp(T)

Temporarily changes the value of the property.

[MustDisposeResource]
public IDisposable SetTemp(T value)

Parameters

value T

Returns

IDisposable

Call System.IDisposable.Dispose() to restore the original value of the property.

Examples

using (PropertyPointer.For(() => someProperty).SetTemp(someValue))
{
   // ...
}