using Qrakhen.Qamp.Core.Collections.Abstractions;
using System.Collections;
namespace Qrakhen.Qamp.Core.Collections;
///
/// Basically just a normal array, but implements to be used with .
///
///
public class FixedArray : IEnumerable, IGetSet
{
protected T[] Data;
public long Length => Data.LongLength;
public T this[long index] {
get => Get(index);
set => Set(index, value);
}
public FixedArray(IEnumerable data)
{
Data = data.ToArray();
}
public T Get(long index) => Data[index];
public void Set(long index, T value)
{
Data[index] = value;
}
public IEnumerator GetEnumerator()
{
foreach (var item in Data)
yield return item;
}
IEnumerator IEnumerable.GetEnumerator()
=> GetEnumerator();
}