NanoByte.Common
Static Public Member Functions | List of all members
NanoByte.Common.UpdateUtils Class Reference

Provides neat little code-shortcuts for updating properties. More...

Static Public Member Functions

static void To< T > (this T value, ref T original, ref bool updated)
 Updates a value and sets a boolean flag to true if the original value actually changed. More...
 
static void To< T > (this T value, ref T original, ref bool updated1, ref bool updated2)
 Updates a value and sets two boolean flags to true if the original value actually changed. More...
 
static void To (this string value, ref string original, ref bool updated)
 Updates a value and sets a boolean flag to true if the original value actually changed More...
 
static void To (this string value, ref string original, ref bool updated1, ref bool updated2)
 Updates a value and sets two boolean flags to true if the original value actually changed More...
 
static void To< T > (this T value, ref T original, [CanBeNull, InstantHandle] Action updated)
 Updates a value and calls back a delegate if the original value actually changed. More...
 
static void To (this string value, ref string original, [CanBeNull, InstantHandle] Action updated)
 Updates a value and calls back a delegate if the original value actually changed. More...
 
static void Swap< T > (ref T value1, ref T value2)
 Swaps the content of two fields. More...
 

Detailed Description

Provides neat little code-shortcuts for updating properties.

Member Function Documentation

◆ Swap< T >()

static void NanoByte.Common.UpdateUtils.Swap< T > ( ref T  value1,
ref T  value2 
)
inlinestatic

Swaps the content of two fields.

Template Parameters
TThe type of objects to swap.
Parameters
value1The first field which will afterwards carry the content of value2 .
value2The first field which will afterwards carry the content of value1 .

◆ To() [1/3]

static void NanoByte.Common.UpdateUtils.To ( this string  value,
ref string  original,
ref bool  updated 
)
inlinestatic

Updates a value and sets a boolean flag to true if the original value actually changed

Parameters
valueThe new value
originalThe original value to update
updatedGets set to true if value is different from original

◆ To() [2/3]

static void NanoByte.Common.UpdateUtils.To ( this string  value,
ref string  original,
ref bool  updated1,
ref bool  updated2 
)
inlinestatic

Updates a value and sets two boolean flags to true if the original value actually changed

Parameters
valueThe new value
originalThe original value to update
updated1Gets set to true if value is different from original
updated2Gets set to true if value is different from original

◆ To() [3/3]

static void NanoByte.Common.UpdateUtils.To ( this string  value,
ref string  original,
[CanBeNull, InstantHandle] Action  updated 
)
inlinestatic

Updates a value and calls back a delegate if the original value actually changed.

Parameters
valueThe new value.
originalThe original value to update.
updatedGets called if value is different from original.

◆ To< T >() [1/3]

static void NanoByte.Common.UpdateUtils.To< T > ( this T  value,
ref T  original,
ref bool  updated 
)
inlinestatic

Updates a value and sets a boolean flag to true if the original value actually changed.

Template Parameters
TThe type of data to update.
Parameters
valueThe new value.
originalThe original value to update.
updatedGets set to true if value is different from original.
Type Constraints
T :struct 

◆ To< T >() [2/3]

static void NanoByte.Common.UpdateUtils.To< T > ( this T  value,
ref T  original,
ref bool  updated1,
ref bool  updated2 
)
inlinestatic

Updates a value and sets two boolean flags to true if the original value actually changed.

Template Parameters
TThe type of data to update.
Parameters
valueThe new value.
originalThe original value to update.
updated1Gets set to true if value is different from original.
updated2Gets set to true if value is different from original.
Type Constraints
T :struct 

◆ To< T >() [3/3]

static void NanoByte.Common.UpdateUtils.To< T > ( this T  value,
ref T  original,
[CanBeNull, InstantHandle] Action  updated 
)
inlinestatic

Updates a value and calls back a delegate if the original value actually changed.

Template Parameters
TThe type of data to update.
Parameters
valueThe new value.
originalThe original value to update.
updatedGets called if value is different from original.
Type Constraints
T :struct 

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