Show / Hide Table of Contents

Struct UserDataStorage

Provides access to user data associated with the object.

Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.ReferenceEquals(Object, Object)
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public struct UserDataStorage
Remarks

This is by-ref struct because user data should have the same lifetime as its owner.

Methods

| Improve this Doc View Source

CopyTo(Object)

Replaces user data of the object with the copy of the current one.

Declaration
public void CopyTo(object obj)
Parameters
Type Name Description
Object obj

The object which user data has to be replaced with the copy of the current one.

| Improve this Doc View Source

Equals(Object)

Determines whether this storage is attached to the given object.

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
Object other

Other object to check.

Returns
Type Description
Boolean

true, if this storage is attached to other object; otherwise, false.

Overrides
ValueType.Equals(Object)
| Improve this Doc View Source

Get<TValue>(UserDataSlot<TValue>)

Gets user data.

Declaration
public TValue Get<TValue>(UserDataSlot<TValue> slot)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

Returns
Type Description
TValue

User data; or default(V) if there is no user data associated with slot.

Type Parameters
Name Description
TValue

Type of data.

| Improve this Doc View Source

Get<TValue>(UserDataSlot<TValue>, TValue)

Gets user data.

Declaration
public TValue Get<TValue>(UserDataSlot<TValue> slot, TValue defaultValue)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

TValue defaultValue

Default value to be returned if no user data contained in this collection.

Returns
Type Description
TValue

User data.

Type Parameters
Name Description
TValue

Type of data.

| Improve this Doc View Source

GetHashCode()

Computes identity hash code for this storage.

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

The identity hash code for this storage.

Overrides
ValueType.GetHashCode()
| Improve this Doc View Source

GetOrSet<TValue>(UserDataSlot<TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<TValue>(UserDataSlot<TValue> slot)

    where TValue : new()
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

GetOrSet<TValue>(UserDataSlot<TValue>, ValueFunc<TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<TValue>(UserDataSlot<TValue> slot, in ValueFunc<TValue> valueFactory)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

ValueFunc<TValue> valueFactory

The value supplier which is called when no user data exists.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

GetOrSet<TValue>(UserDataSlot<TValue>, Func<TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<TValue>(UserDataSlot<TValue> slot, Func<TValue> valueFactory)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

Func<TValue> valueFactory

The value supplier which is called when no user data exists.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

GetOrSet<TBase, T>(UserDataSlot<TBase>)

Gets existing user data or creates a new data and return it.

Declaration
public TBase GetOrSet<TBase, T>(UserDataSlot<TBase> slot)

    where T : class, TBase, new()
Parameters
Type Name Description
UserDataSlot<TBase> slot

The slot identifying user data.

Returns
Type Description
TBase

The data associated with the slot.

Type Parameters
Name Description
TBase

The type of user data associated with arbitrary object.

T

The derived type with public parameterless constructor.

| Improve this Doc View Source

GetOrSet<T, TValue>(UserDataSlot<TValue>, T, ValueFunc<T, TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<T, TValue>(UserDataSlot<TValue> slot, T arg, in ValueFunc<T, TValue> valueFactory)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

T arg

The argument to be passed into factory.

ValueFunc<T, TValue> valueFactory

The value supplier which is called when no user data exists.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
T

The type of the argument to be passed into factory.

TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

GetOrSet<T, TValue>(UserDataSlot<TValue>, T, Func<T, TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<T, TValue>(UserDataSlot<TValue> slot, T arg, Func<T, TValue> valueFactory)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

T arg

The argument to be passed into factory.

Func<T, TValue> valueFactory

The value supplier which is called when no user data exists.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
T

The type of the argument to be passed into factory.

TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

GetOrSet<T1, T2, TValue>(UserDataSlot<TValue>, T1, T2, ValueFunc<T1, T2, TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<T1, T2, TValue>(UserDataSlot<TValue> slot, T1 arg1, T2 arg2, in ValueFunc<T1, T2, TValue> valueFactory)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

T1 arg1

The first argument to be passed into factory.

T2 arg2

The second argument to be passed into factory.

ValueFunc<T1, T2, TValue> valueFactory

The value supplier which is called when no user data exists.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
T1

The type of the first argument to be passed into factory.

T2

The type of the second argument to be passed into factory.

TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

GetOrSet<T1, T2, TValue>(UserDataSlot<TValue>, T1, T2, Func<T1, T2, TValue>)

Gets existing user data or creates a new data and return it.

Declaration
public TValue GetOrSet<T1, T2, TValue>(UserDataSlot<TValue> slot, T1 arg1, T2 arg2, Func<T1, T2, TValue> valueFactory)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

T1 arg1

The first argument to be passed into factory.

T2 arg2

The second argument to be passed into factory.

Func<T1, T2, TValue> valueFactory

The value supplier which is called when no user data exists.

Returns
Type Description
TValue

The data associated with the slot.

Type Parameters
Name Description
T1

The type of the first argument to be passed into factory.

T2

The type of the second argument to be passed into factory.

TValue

The type of user data associated with arbitrary object.

| Improve this Doc View Source

Remove<TValue>(UserDataSlot<TValue>)

Removes user data slot.

Declaration
public bool Remove<TValue>(UserDataSlot<TValue> slot)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

Returns
Type Description
Boolean

true, if data is removed from this collection.

Type Parameters
Name Description
TValue

The type of user data.

| Improve this Doc View Source

Remove<TValue>(UserDataSlot<TValue>, out TValue)

Removes user data slot.

Declaration
public bool Remove<TValue>(UserDataSlot<TValue> slot, out TValue userData)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

TValue userData

Remove user data.

Returns
Type Description
Boolean

true, if data is removed from this collection.

Type Parameters
Name Description
TValue

The type of user data.

| Improve this Doc View Source

Set<TValue>(UserDataSlot<TValue>, TValue)

Sets user data.

Declaration
public void Set<TValue>(UserDataSlot<TValue> slot, TValue userData)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

TValue userData

User data to be saved in this collection.

Type Parameters
Name Description
TValue

Type of data.

| Improve this Doc View Source

ToString()

Returns textual representation of this storage.

Declaration
public override string ToString()
Returns
Type Description
String

The textual representation of this storage.

Overrides
ValueType.ToString()
| Improve this Doc View Source

TryGet<TValue>(UserDataSlot<TValue>, out TValue)

Tries to get user data.

Declaration
public bool TryGet<TValue>(UserDataSlot<TValue> slot, out TValue userData)
Parameters
Type Name Description
UserDataSlot<TValue> slot

The slot identifying user data.

TValue userData

User data.

Returns
Type Description
Boolean

true, if user data slot exists in this collection.

Type Parameters
Name Description
TValue

Type of data.

Operators

| Improve this Doc View Source

Equality(UserDataStorage, UserDataStorage)

Determines whether two stores are for the same object.

Declaration
public static bool operator ==(UserDataStorage first, UserDataStorage second)
Parameters
Type Name Description
UserDataStorage first

The first storage to compare.

UserDataStorage second

The second storage to compare.

Returns
Type Description
Boolean

true, if two stores are for the same object; otherwise, false.

| Improve this Doc View Source

Inequality(UserDataStorage, UserDataStorage)

Determines whether two stores are not for the same object.

Declaration
public static bool operator !=(UserDataStorage first, UserDataStorage second)
Parameters
Type Name Description
UserDataStorage first

The first storage to compare.

UserDataStorage second

The second storage to compare.

Returns
Type Description
Boolean

true, if two stores are not for the same object; otherwise, false.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX