Client LuaCsForBarotrauma
NetCollection.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using System.Collections.Immutable;
4 
5 namespace Barotrauma
6 {
7  [NetworkSerialize]
8  public readonly record struct NetCollection<T>(ImmutableArray<T> Array) : INetSerializableStruct, IEnumerable<T>
9  {
10  public static readonly NetCollection<T> Empty = new(ImmutableArray<T>.Empty);
11 
12  public NetCollection(params T[] elements) : this(elements.ToImmutableArray()) { }
13 
14  IEnumerator<T> IEnumerable<T>.GetEnumerator() => ((IEnumerable<T>)Array).GetEnumerator();
15  IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)Array).GetEnumerator();
16  }
17 }