NetDictionary<TKey,TValue>class

A networkable dictionary for use with the `Sandbox.SyncAttribute` and `Sandbox.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 MyBoolTable { get; set; } = new(); public void SetBoolState( string key, bool state ) { if ( IsProxy ) return; MyBoolTable[key] = state; } }

object→NetDictionary<TKey,TValue>
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.NetDictionary<TKey,TValue>

Constructors1

Showing 1 constructors

public NetDictionary<TKey,TValue>()PUBLICCONSTRUCTOR

Methods11

Showing 11 methods

public virtual sealed void Clear()PUBLICVIRTUAL

Returns:void—

public virtual sealed bool Contains(System.Collections.Generic.KeyValuePair`2<TKey,TValue> item)PUBLICVIRTUAL

ParameterTypeDescription
itemKeyValuePair<TKey,TValue>—
Returns:bool—

public virtual sealed bool ContainsKey(TKey key)PUBLICVIRTUAL

ParameterTypeDescription
keyTKey—
Returns:bool—

public virtual sealed void CopyTo(System.Collections.Generic.KeyValuePair`2<TKey,TValue>[] array, int arrayIndex)PUBLICVIRTUAL

ParameterTypeDescription
arrayKeyValuePair<TKey,TValue>[]—
arrayIndexint—
Returns:void—

public virtual sealed void Dispose()PUBLICVIRTUAL

Returns:void—

public virtual sealed System.Collections.Generic.IEnumerator`1<System.Collections.Generic.KeyValuePair`2<TKey,TValue>> GetEnumerator()PUBLICVIRTUAL

Returns:IEnumerator<KeyValuePair<TKey,TValue>>—

public virtual sealed bool TryGetValue(TKey key, TValue value)PUBLICVIRTUAL

ParameterTypeDescription
keyTKey—
valueTValue—
Returns:bool—

Properties4

Showing 4 properties

public virtual sealed int Sandbox.NetDictionary<TKey,TValue>.Count { get; set; }PUBLICVIRTUALGETSET

Returns:int—

public virtual sealed TValue Sandbox.NetDictionary<TKey,TValue>.Item { get; set; }PUBLICVIRTUALGETSET

Returns:TValue—

public virtual sealed System.Collections.Generic.ICollection`1<TKey> Sandbox.NetDictionary<TKey,TValue>.Keys { get; set; }PUBLICVIRTUALGETSET

Returns:ICollection<TKey>—

public virtual sealed System.Collections.Generic.ICollection`1<TValue> Sandbox.NetDictionary<TKey,TValue>.Values { get; set; }PUBLICVIRTUALGETSET

Returns:ICollection<TValue>—

On this page