NanoByte.Common  2.9.0
NanoByte.Common.PropertyPointer< T > Class Template Reference

Wraps delegate-based access to a value as a property. More...

Inheritance diagram for NanoByte.Common.PropertyPointer< T >:

Public Member Functions

 PropertyPointer (Func< T > getValue, Action< T > setValue, T defaultValue, bool needsEncoding=false)
 Creates a property pointer. More...
 

Static Public Member Functions

static PropertyPointer< T > For< T > (Func< T > getValue, Action< T > setValue, T defaultValue, bool needsEncoding=false)
 Creates a property pointer. More...
 
static PropertyPointer< T?> For< T > (Func< T?> getValue, Action< T?> setValue, bool needsEncoding=false)
 Creates a property pointer. More...
 
static PropertyPointer< T > For< T > (Expression< Func< T >> getValue, T defaultValue, bool needsEncoding=false)
 Creates a property pointer. More...
 
static PropertyPointer< T?> For< T > (Expression< Func< T?>> getValue, bool needsEncoding=false)
 Creates a property pointer. More...
 
static PropertyPointer< string > ToStringPointer (this PropertyPointer< bool > pointer)
 Wraps a bool pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer (this PropertyPointer< int > pointer)
 Wraps an int pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer (this PropertyPointer< long > pointer)
 Wraps an long pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer (this PropertyPointer< TimeSpan > pointer)
 Wraps a TimeSpan pointer in a string pointer. More...
 
static PropertyPointer< string > ToStringPointer (this PropertyPointer< Uri?> pointer)
 Wraps an Uri pointer in a string pointer. Maps empty strings to null URIs. More...
 

Properties

Value [get, set]
 Transparent access to the wrapper value. More...
 
DefaultValue [get]
 The default value of the property. More...
 
bool IsDefaultValue [get]
 true if Value is equal to DefaultValue. More...
 
bool NeedsEncoding [get]
 Indicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file. More...
 

Detailed Description

Wraps delegate-based access to a value as a property.

Provides factory methods for PropertyPointer<T>.

Template Parameters
TThe type of value the property contains.

Constructor & Destructor Documentation

◆ PropertyPointer()

NanoByte.Common.PropertyPointer< T >.PropertyPointer ( Func< T >  getValue,
Action< T >  setValue,
defaultValue,
bool  needsEncoding = false 
)
inline

Creates a property pointer.

Parameters
getValueA delegate that returns the current value.
setValueA delegate that sets the value.
defaultValueThe default value of the property.
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

Member Function Documentation

◆ For< T >() [1/4]

static PropertyPointer<T> NanoByte.Common.PropertyPointer< T >.For< T > ( Expression< Func< T >>  getValue,
defaultValue,
bool  needsEncoding = false 
)
inlinestatic

Creates a property pointer.

Template Parameters
TThe type of value the property contains.
Parameters
getValueAn expression pointing to the property.
defaultValueThe default value of the property.
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

◆ For< T >() [2/4]

static PropertyPointer<T?> NanoByte.Common.PropertyPointer< T >.For< T > ( Expression< Func< T?>>  getValue,
bool  needsEncoding = false 
)
static

Creates a property pointer.

Template Parameters
TThe type of value the property contains.
Parameters
getValueAn expression pointing to the property.
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.
Type Constraints
T :class 
T :For 
T :getValue 
T :null 
T :needsEncoding 

◆ For< T >() [3/4]

static PropertyPointer<T> NanoByte.Common.PropertyPointer< T >.For< T > ( Func< T >  getValue,
Action< T >  setValue,
defaultValue,
bool  needsEncoding = false 
)
static

Creates a property pointer.

Template Parameters
TThe type of value the property contains.
Parameters
getValueA delegate that returns the current value.
setValueA delegate that sets the value.
defaultValueThe default value of the property.
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

◆ For< T >() [4/4]

static PropertyPointer<T?> NanoByte.Common.PropertyPointer< T >.For< T > ( Func< T?>  getValue,
Action< T?>  setValue,
bool  needsEncoding = false 
)
static

Creates a property pointer.

Template Parameters
TThe type of value the property contains.
Parameters
getValueA delegate that returns the current value.
setValueA delegate that sets the value.
needsEncodingIndicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.
Type Constraints
T :class 
T :For 
T :getValue 
T :setValue 
T :null 
T :needsEncoding 

◆ ToStringPointer() [1/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( this PropertyPointer< bool >  pointer)
static

Wraps a bool pointer in a string pointer.

◆ ToStringPointer() [2/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( this PropertyPointer< int >  pointer)
static

Wraps an int pointer in a string pointer.

◆ ToStringPointer() [3/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( this PropertyPointer< long >  pointer)
static

Wraps an long pointer in a string pointer.

◆ ToStringPointer() [4/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( this PropertyPointer< TimeSpan >  pointer)
static

Wraps a TimeSpan pointer in a string pointer.

◆ ToStringPointer() [5/5]

static PropertyPointer<string> NanoByte.Common.PropertyPointer< T >.ToStringPointer ( this PropertyPointer< Uri?>  pointer)
static

Wraps an Uri pointer in a string pointer. Maps empty strings to null URIs.

Property Documentation

◆ DefaultValue

T NanoByte.Common.PropertyPointer< T >.DefaultValue
get

The default value of the property.

◆ IsDefaultValue

bool NanoByte.Common.PropertyPointer< T >.IsDefaultValue
get

true if Value is equal to DefaultValue.

◆ NeedsEncoding

bool NanoByte.Common.PropertyPointer< T >.NeedsEncoding
get

Indicates that this property needs to be encoded (e.g. as base64) before it can be stored in a file.

◆ Value

T NanoByte.Common.PropertyPointer< T >.Value
getset

Transparent access to the wrapper value.


The documentation for this class was generated from the following file: