Show / Hide Table of Contents

Class PropertyPointer<T>

Wraps delegate-based access to a property.

Inheritance
Object
PropertyPointer<T>
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))
{
   // ...
}

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher