class
NetDictionary<TKey,TValue>
public sealed class NetDictionary<TKey,TValue> A networkable dictionary for use with the SyncAttribute and HostSyncAttribute. Only changes will be networked instead of sending the whole dictionary every time, so it's more efficient. Example usage: public class MyComponent : Component { [Sync] public NetDictionary<string,bool> MyBoolTable { get; set; } = new(); public void SetBoolState( string key, bool state ) { if ( IsProxy ) return; MyBoolTable[key] = state; } }
Constructors
NetDictionary<TKey,TValue>() Properties
| Name | Type | Description |
|---|---|---|
Values virtual | ICollection<TValue> | |
Keys virtual | ICollection<TKey> | |
Count virtual | Int32 | |
Item virtual | TValue |
Methods
virtual Void Dispose() virtual Void Add(TKey key, TValue value) virtual Void Add(KeyValuePair<TKey, TValue> item) virtual Void Clear() virtual Boolean ContainsKey(TKey key) virtual Boolean Contains(KeyValuePair<TKey, TValue> item) virtual Void CopyTo(KeyValuePair<TKey, TValue>[] array, Int32 arrayIndex) virtual Boolean Remove(KeyValuePair<TKey, TValue> item) virtual Boolean Remove(TKey key) virtual Boolean TryGetValue(TKey key, TValue value) virtual KeyValuePair<TKey, TValue>> GetEnumerator() Fields
| Name | Type | Description |
|---|---|---|
OnChanged | NetDictionaryChangeEvent<TKey, TValue>> | Get notified when the dictionary is changed. |