Show / Hide Table of Contents

# Class SyncList<T>

##### Inheritance

object
InternalBaseClass
SyncableField
SyncList<T>

##### Implements

ICollection<T>
IReadOnlyList<T>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable

##### Inherited Members

SyncableField.IsClient
SyncableField.IsServer
InternalBaseClass.ExecuteRPC(in RemoteCall)
InternalBaseClass.ExecuteRPC<T>(in RemoteCall<T>, T)
InternalBaseClass.ExecuteRPC<T>(in RemoteCallSpan<T>, ReadOnlySpan<T>)
InternalBaseClass.ExecuteRPC<T>(in RemoteCallSerializable<T>, T)

###### Namespace: LiteEntitySystem.Extensions

###### Assembly: LiteEntitySystem.dll

##### Syntax

    public class SyncList<T> : SyncableField, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable where T : unmanaged

##### Type Parameters

Name | Description
--- | ---
T |

### Constructors

#### SyncList()

##### Declaration

    public SyncList()

#### SyncList(int)

##### Declaration

    public SyncList(int capacity)

##### Parameters

Type | Name | Description
--- | --- | ---
int | capacity |

### Properties

#### Count

Gets the number of elements contained in the ICollection<T>.

##### Declaration

    public int Count { get; }

##### Property Value

Type | Description
--- | ---
int | The number of elements contained in the ICollection<T>.

#### IsReadOnly

Gets a value indicating whether the ICollection<T> is read-only.

##### Declaration

    public bool IsReadOnly { get; }

##### Property Value

Type | Description
--- | ---
bool | true if the ICollection<T> is read-only; otherwise, false.

#### this[int]

Gets the element at the specified index in the read-only list.

##### Declaration

    public T this[int index] { get; set; }

##### Parameters

Type | Name | Description
--- | --- | ---
int | index | The zero-based index of the element to get.

##### Property Value

Type | Description
--- | ---
T | The element at the specified index in the read-only list.

### Methods

#### Add(T)

Adds an item to the ICollection<T>.

##### Declaration

    public void Add(T item)

##### Parameters

Type | Name | Description
--- | --- | ---
T | item | The object to add to the ICollection<T>.

##### Exceptions

Type | Condition
--- | ---
NotSupportedException | The ICollection<T> is read-only.

#### AfterReadRPC()

##### Declaration

    protected override void AfterReadRPC()

##### Overrides

SyncableField.AfterReadRPC()

#### BeforeReadRPC()

##### Declaration

    protected override void BeforeReadRPC()

##### Overrides

SyncableField.BeforeReadRPC()

#### Clear()

Removes all items from the ICollection<T>.

##### Declaration

    public void Clear()

##### Exceptions

Type | Condition
--- | ---
NotSupportedException | The ICollection<T> is read-only.

#### Contains(T)

Determines whether the ICollection<T> contains a specific value.

##### Declaration

    public bool Contains(T item)

##### Parameters

Type | Name | Description
--- | --- | ---
T | item | The object to locate in the ICollection<T>.

##### Returns

Type | Description
--- | ---
bool | true if `item` is found in the ICollection<T>; otherwise, false.

#### CopyTo(T[], int)

Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.

##### Declaration

    public void CopyTo(T[] array, int arrayIndex)

##### Parameters

Type | Name | Description
--- | --- | ---
T[] | array | The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
int | arrayIndex | The zero-based index in `array` at which copying begins.

##### Exceptions

Type | Condition
--- | ---
ArgumentNullException | `array` is null.
ArgumentOutOfRangeException | `arrayIndex` is less than 0.
ArgumentException | The number of elements in the source ICollection<T> is greater than the available space from `arrayIndex` to the end of the destination `array`.

#### GetEnumerator()

Returns an enumerator that iterates through the collection.

##### Declaration

    public IEnumerator<T> GetEnumerator()

##### Returns

Type | Description
--- | ---
IEnumerator<T> | An enumerator that can be used to iterate through the collection.

#### IndexOf(T)

##### Declaration

    public int IndexOf(T item)

##### Parameters

Type | Name | Description
--- | --- | ---
T | item |

##### Returns

Type | Description
--- | ---
int |

#### OnRollback()

##### Declaration

    protected override void OnRollback()

##### Overrides

SyncableField.OnRollback()

#### OnSyncRequested()

##### Declaration

    protected override void OnSyncRequested()

##### Overrides

InternalBaseClass.OnSyncRequested()

#### RegisterRPC(ref SyncableRPCRegistrator)

##### Declaration

    protected override void RegisterRPC(ref SyncableRPCRegistrator r)

##### Parameters

Type | Name | Description
--- | --- | ---
SyncableRPCRegistrator | r |

##### Overrides

SyncableField.RegisterRPC(ref SyncableRPCRegistrator)

#### Remove(T)

Removes the first occurrence of a specific object from the ICollection<T>.

##### Declaration

    public bool Remove(T item)

##### Parameters

Type | Name | Description
--- | --- | ---
T | item | The object to remove from the ICollection<T>.

##### Returns

Type | Description
--- | ---
bool | true if `item` was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if `item` is not found in the original ICollection<T>.

##### Exceptions

Type | Condition
--- | ---
NotSupportedException | The ICollection<T> is read-only.

#### RemoveAt(int)

##### Declaration

    public void RemoveAt(int index)

##### Parameters

Type | Name | Description
--- | --- | ---
int | index |

#### ToArray()

##### Declaration

    public T[] ToArray()

##### Returns

Type | Description
--- | ---
T[] |

### Implements

ICollection<T>
IReadOnlyList<T>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable