Photon Fusion 2.0.3

Public Member Functions | Static Public Member Functions | Static Public Attributes | Properties | List of all members
SerializableDictionary< TKey, TValue > Class Template Reference

A serializable dictionary. More...

Inherits SerializableDictionary, IDictionary< TKey, TValue >, and ISerializationCallbackReceiver.

Public Member Functions

void Add (TKey key, TValue value)
 Adds the specified key and value to the SerializableDictionary. More...
 
virtual void Clear ()
 Removes all keys and values from the SerializableDictionary. More...
 
bool ContainsKey (TKey key)
 Determines whether the SerializableDictionary contains the specified key. More...
 
Dictionary< TKey, TValue >.Enumerator GetEnumerator ()
 Returns an enumerator that iterates through the SerializableDictionary. More...
 
bool Remove (TKey key)
 Removes the value with the specified key from the SerializableDictionary. More...
 
void Reset ()
 Resets the SerializableDictionary, clearing its internal dictionary. More...
 
void Store ()
 Stores the SerializableDictionary's data into an array for serialization. This includes handling duplicates and null keys. More...
 
bool TryGetValue (TKey key, out TValue value)
 Gets the value associated with the specified key. More...
 

Static Public Member Functions

static SerializableDictionary< TKey, TValue > Create< TKey, TValue > ()
 Creates a new serializable dictionary. More...
 
static SerializableDictionary< TKey, TValue > Wrap (Dictionary< TKey, TValue > dictionary)
 Wraps an existing Dictionary into a SerializableDictionary. More...
 

Static Public Attributes

const string EntryKeyPropertyPath = nameof(Entry.Key)
 The property path for the key in the Entry structure. More...
 
const string ItemsPropertyPath = nameof(_items)
 The property path for the items in the SerializableDictionary. More...
 

Properties

int Count [get]
 Gets the number of key/value pairs contained in the SerializableDictionary. More...
 
bool IsReadOnly [get]
 Gets a value indicating whether the SerializableDictionary is read-only. This value is always false. More...
 
Dictionary< TKey, TValue >.KeyCollection Keys [get]
 Gets a collection containing the keys in the SerializableDictionary. More...
 
TValue this[TKey key] [get, set]
 Gets or sets the value associated with the specified key. More...
 
Dictionary< TKey, TValue >.ValueCollection Values [get]
 Gets a collection containing the values in the SerializableDictionary. More...
 

Detailed Description

A serializable dictionary.

Template Parameters
TKeyThe type of the dictionary key.
TValueThe type of the dictionary value.

This class is not thread-safe.

Member Function Documentation

◆ Add()

void Add ( TKey  key,
TValue  value 
)

Adds the specified key and value to the SerializableDictionary.

Parameters
keyThe key of the element to add.
valueThe value of the element to add.

◆ Clear()

virtual void Clear ( )
virtual

Removes all keys and values from the SerializableDictionary.

◆ ContainsKey()

bool ContainsKey ( TKey  key)

Determines whether the SerializableDictionary contains the specified key.

Parameters
keyThe key to locate in the SerializableDictionary.
Returns
true if the SerializableDictionary contains an element with the specified key; otherwise, false.

◆ Create< TKey, TValue >()

static SerializableDictionary<TKey, TValue> Create< TKey, TValue > ( )
static

Creates a new serializable dictionary.

Template Parameters
TKeyThe type of the dictionary key.
TValueThe type of the dictionary value.
Returns
A new serializable dictionary.

◆ GetEnumerator()

Dictionary<TKey, TValue>.Enumerator GetEnumerator ( )

Returns an enumerator that iterates through the SerializableDictionary.

Returns
A Dictionary{TKey,TValue}.Enumerator structure for the SerializableDictionary.

◆ Remove()

bool Remove ( TKey  key)

Removes the value with the specified key from the SerializableDictionary.

Parameters
keyThe key of the element to remove.
Returns
true if the element is successfully found and removed; otherwise, false. This method returns false if key is not found in the SerializableDictionary.

◆ Reset()

void Reset ( )

Resets the SerializableDictionary, clearing its internal dictionary.

◆ Store()

void Store ( )

Stores the SerializableDictionary's data into an array for serialization. This includes handling duplicates and null keys.

◆ TryGetValue()

bool TryGetValue ( TKey  key,
out TValue  value 
)

Gets the value associated with the specified key.

Parameters
keyThe key of the value to get.
valueWhen this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Returns
true if the SerializableDictionary contains an element with the specified key; otherwise, false.

◆ Wrap()

static SerializableDictionary<TKey, TValue> Wrap ( Dictionary< TKey, TValue >  dictionary)
static

Wraps an existing Dictionary into a SerializableDictionary.

Parameters
dictionaryThe Dictionary to be wrapped.
Returns
A new SerializableDictionary that wraps the provided Dictionary.

Member Data Documentation

◆ EntryKeyPropertyPath

const string EntryKeyPropertyPath = nameof(Entry.Key)
static

The property path for the key in the Entry structure.

◆ ItemsPropertyPath

const string ItemsPropertyPath = nameof(_items)
static

The property path for the items in the SerializableDictionary.

Property Documentation

◆ Count

int Count
get

Gets the number of key/value pairs contained in the SerializableDictionary.

◆ IsReadOnly

bool IsReadOnly
get

Gets a value indicating whether the SerializableDictionary is read-only. This value is always false.

◆ Keys

Dictionary<TKey, TValue>.KeyCollection Keys
get

Gets a collection containing the keys in the SerializableDictionary.

◆ this[TKey key]

TValue this[TKey key]
getset

Gets or sets the value associated with the specified key.

Parameters
keyThe key of the value to get or set.
Returns
The value associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException, and a set operation creates a new element with the specified key.

◆ Values

Dictionary<TKey, TValue>.ValueCollection Values
get

Gets a collection containing the values in the SerializableDictionary.