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>, T, Boolean)

Creates a property pointer.

Declaration
public static PropertyPointer<T> For<T>(Func<T> getValue, Action<T> setValue, T defaultValue, bool needsEncoding = false)
Parameters
Type Name Description
Func<T> getValue

A delegate that returns the current value.

Action<T> setValue

A delegate that sets the value.

T defaultValue

The default value of the property.

Boolean needsEncoding

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

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

The type of value the property contains.

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

Creates a property pointer.

Declaration
public static PropertyPointer<T> For<T>(Func<T> getValue, Action<T> setValue, bool needsEncoding = false)
    where T : class
Parameters
Type Name Description
Func<T> getValue

A delegate that returns the current value.

Action<T> setValue

A delegate that sets the value.

Boolean needsEncoding

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

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

The type of value the property contains.

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

Creates a property pointer.

Declaration
public static PropertyPointer<T> For<T>(Expression<Func<T>> getValue, T defaultValue, bool needsEncoding = false)
Parameters
Type Name Description
Expression<Func<T>> getValue

An expression pointing to the property.

T defaultValue

The default value of the property.

Boolean needsEncoding

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

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

The type of value the property contains.

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

Creates a property pointer.

Declaration
public static PropertyPointer<T> For<T>(Expression<Func<T>> getValue, bool needsEncoding = false)
    where T : class
Parameters
Type Name Description
Expression<Func<T>> getValue

An expression pointing to the property.

Boolean needsEncoding

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

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

The type of value the property contains.

ToStringPointer(PropertyPointer<Boolean>)

Wraps a Boolean pointer in a String pointer.

Declaration
public static PropertyPointer<string> ToStringPointer(this PropertyPointer<bool> pointer)
Parameters
Type Name Description
PropertyPointer<Boolean> pointer
Returns
Type Description
PropertyPointer<String>

ToStringPointer(PropertyPointer<Int32>)

Wraps an Int32 pointer in a String pointer.

Declaration
public static PropertyPointer<string> ToStringPointer(this PropertyPointer<int> pointer)
Parameters
Type Name Description
PropertyPointer<Int32> pointer
Returns
Type Description
PropertyPointer<String>

ToStringPointer(PropertyPointer<Int64>)

Wraps an Int64 pointer in a String pointer.

Declaration
public static PropertyPointer<string> ToStringPointer(this PropertyPointer<long> pointer)
Parameters
Type Name Description
PropertyPointer<Int64> pointer
Returns
Type Description
PropertyPointer<String>

ToStringPointer(PropertyPointer<TimeSpan>)

Wraps a TimeSpan pointer in a String pointer.

Declaration
public static PropertyPointer<string> ToStringPointer(this PropertyPointer<TimeSpan> pointer)
Parameters
Type Name Description
PropertyPointer<TimeSpan> pointer
Returns
Type Description
PropertyPointer<String>

ToStringPointer(PropertyPointer<Uri>)

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

Declaration
public static PropertyPointer<string> ToStringPointer(this PropertyPointer<Uri> pointer)
Parameters
Type Name Description
PropertyPointer<Uri> pointer
Returns
Type Description
PropertyPointer<String>
In This Article
Back to top Copyright Bastian Eicher