Skip to content

Commit 065ac9f

Browse files
committed
Changed Dictionary to IDictionary
1 parent 9be8503 commit 065ac9f

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

MLAPI/Data/NetworkedCollections/NetworkedDictionary.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal enum NetworkedListEventType
2525
}
2626

2727
public NetworkedVarSettings Settings = new NetworkedVarSettings();
28-
private readonly Dictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>();
28+
private readonly IDictionary<TKey, TValue> dictionary = new Dictionary<TKey, TValue>();
2929
private NetworkedBehaviour networkedBehaviour;
3030
private readonly List<NetworkedDictionaryEvent<TKey, TValue>> dirtyEvents = new List<NetworkedDictionaryEvent<TKey, TValue>>();
3131

@@ -215,13 +215,13 @@ public TValue this[TKey key]
215215
}
216216
}
217217

218-
public ICollection<TKey> Keys => ((IDictionary<TKey, TValue>)dictionary).Keys;
218+
public ICollection<TKey> Keys => dictionary.Keys;
219219

220-
public ICollection<TValue> Values => ((IDictionary<TKey, TValue>)dictionary).Values;
220+
public ICollection<TValue> Values => dictionary.Values;
221221

222222
public int Count => dictionary.Count;
223223

224-
public bool IsReadOnly => ((IDictionary<TKey, TValue>)dictionary).IsReadOnly;
224+
public bool IsReadOnly => dictionary.IsReadOnly;
225225

226226
public void Add(TKey key, TValue value)
227227
{
@@ -236,7 +236,7 @@ public void Add(TKey key, TValue value)
236236

237237
public void Add(KeyValuePair<TKey, TValue> item)
238238
{
239-
((IDictionary<TKey, TValue>)dictionary).Add(item);
239+
dictionary.Add(item);
240240
dirtyEvents.Add(new NetworkedDictionaryEvent<TKey, TValue>()
241241
{
242242
eventType = NetworkedDictionaryEvent<TKey, TValue>.NetworkedListEventType.Add,
@@ -256,7 +256,7 @@ public void Clear()
256256

257257
public bool Contains(KeyValuePair<TKey, TValue> item)
258258
{
259-
return ((IDictionary<TKey, TValue>)dictionary).Contains(item);
259+
return dictionary.Contains(item);
260260
}
261261

262262
public bool ContainsKey(TKey key)
@@ -266,12 +266,12 @@ public bool ContainsKey(TKey key)
266266

267267
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
268268
{
269-
((IDictionary<TKey, TValue>)dictionary).CopyTo(array, arrayIndex);
269+
dictionary.CopyTo(array, arrayIndex);
270270
}
271271

272272
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
273273
{
274-
return ((IDictionary<TKey, TValue>)dictionary).GetEnumerator();
274+
return dictionary.GetEnumerator();
275275
}
276276

277277
public bool Remove(TKey key)
@@ -290,7 +290,7 @@ public bool Remove(TKey key)
290290

291291
public bool Remove(KeyValuePair<TKey, TValue> item)
292292
{
293-
bool state = ((IDictionary<TKey, TValue>)dictionary).Remove(item);
293+
bool state = dictionary.Remove(item);
294294
if (state)
295295
{
296296
dirtyEvents.Add(new NetworkedDictionaryEvent<TKey, TValue>()
@@ -305,7 +305,7 @@ public bool Remove(KeyValuePair<TKey, TValue> item)
305305

306306
IEnumerator IEnumerable.GetEnumerator()
307307
{
308-
return ((IDictionary<TKey, TValue>)dictionary).GetEnumerator();
308+
return dictionary.GetEnumerator();
309309
}
310310
}
311311
}

0 commit comments

Comments
 (0)