2using System.Collections;
3using System.Collections.Generic;
4using System.Diagnostics;
5using System.Runtime.InteropServices;
6using System.Runtime.Serialization;
11[DebuggerDisplay(
"Count = {Count}")]
12public class UDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IDictionary, ICollection, ISerializable, IDeserializationCallback, ISerializationCallbackReceiver
15 private List<TKey>
keys =
new List<TKey>();
18 private List<TValue>
values =
new List<TValue>();
33 public TValue
this[TKey key]
45 object IDictionary.this[
object key]
57 if (key is TKey && (value is TValue || value ==
null))
79 dictionary =
new Dictionary<TKey, TValue>(comparer);
84 this.dictionary =
new Dictionary<TKey, TValue>(
dictionary);
89 dictionary =
new Dictionary<TKey, TValue>(capacity);
94 this.dictionary =
new Dictionary<TKey, TValue>(
dictionary, comparer);
97 public UDictionary(
int capacity, IEqualityComparer<TKey> comparer)
99 dictionary =
new Dictionary<TKey, TValue>(capacity, comparer);
105 for (
int i = 0; i <
keys.Count; i++)
107 if (
keys[i] !=
null && (!(
keys[i] is UnityEngine.Object) || (
bool)(UnityEngine.Object)(
object)
keys[i]))
120 if (
item.Key !=
null && (!(
item.Key is UnityEngine.Object) || (
bool)(UnityEngine.Object)(
object)
item.Key))
138 public void Add(TKey key, TValue value)
143 void IDictionary.Add(
object key,
object value)
145 if (key is TKey && (value is TValue || value ==
null))
156 bool IDictionary.Contains(
object key)
170 void IDictionary.Remove(
object key)
180 return dictionary.TryGetValue(key, out value);
183 IDictionaryEnumerator IDictionary.GetEnumerator()
185 return ((IDictionary)
dictionary).GetEnumerator();
188 public void Add(KeyValuePair<TKey, TValue>
item)
207 void ICollection.CopyTo(Array array,
int index)
211 void ICollection<KeyValuePair<TKey, TValue>>.CopyTo(KeyValuePair<TKey, TValue>[] array,
int arrayIndex)
225 IEnumerator IEnumerable.GetEnumerator()
IEnumerator< KeyValuePair< TKey, TValue > > GetEnumerator()
void GetObjectData(SerializationInfo info, StreamingContext context)
Dictionary< TKey, TValue > dictionary
bool ContainsKey(TKey key)
UDictionary(int capacity, IEqualityComparer< TKey > comparer)
UDictionary(int capacity)
bool Contains(KeyValuePair< TKey, TValue > item)
void OnAfterDeserialize()
UDictionary(IDictionary< TKey, TValue > dictionary)
void OnDeserialization(object sender)
bool TryGetValue(TKey key, out TValue value)
bool Remove(KeyValuePair< TKey, TValue > item)
void Add(TKey key, TValue value)
void Add(KeyValuePair< TKey, TValue > item)
UDictionary(IEqualityComparer< TKey > comparer)
ICollection< TValue > Values
UDictionary(IDictionary< TKey, TValue > dictionary, IEqualityComparer< TKey > comparer)