Class PropertyPointer<T>
Wraps delegate-based access to a property.
Namespace: NanoByte.Common
Assembly: NanoByte.Common.dll
Syntax
public class PropertyPointer<T> : MarshalByRefObject
Type Parameters
Name | Description |
---|---|
T | The type of value the property contains. |
Constructors
PropertyPointer(Func<T>, Action<T>)
Creates a property pointer.
Declaration
public PropertyPointer(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. |
Properties
Value
Transparent access to the wrapper value.
Declaration
public T Value { get; set; }
Property Value
Type | Description |
---|---|
T |
Methods
SetTemp(T)
Temporarily changes the value of the property.
Declaration
public IDisposable SetTemp(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value |
Returns
Type | Description |
---|---|
IDisposable | Call Dispose() to restore the original value of the property. |
Examples
using (PropertyPointer.For(() => someProperty).SetTemp(someValue))
{
// ...
}