Skip to content

Commit

Permalink
Create a nongeneric Il2CppArrayBase class
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 committed May 13, 2024
1 parent 8ea82dd commit 902afb4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Il2CppInterop.Runtime/InteropTypes/Arrays/Il2CppArrayBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@

namespace Il2CppInterop.Runtime.InteropTypes.Arrays;

public abstract class Il2CppArrayBase<T> : Il2CppObjectBase, IList<T>
public abstract class Il2CppArrayBase : Il2CppObjectBase, IEnumerable
{
protected Il2CppArrayBase(IntPtr pointer) : base(pointer)
{
}

public int Length => (int)IL2CPP.il2cpp_array_length(Pointer);

IEnumerator IEnumerable.GetEnumerator()
public abstract IEnumerator GetEnumerator();
}
public abstract class Il2CppArrayBase<T> : Il2CppArrayBase, IList<T>
{
protected Il2CppArrayBase(IntPtr pointer) : base(pointer)
{
return GetEnumerator();
}

public IEnumerator<T> GetEnumerator()
public sealed override IEnumerator<T> GetEnumerator()
{
return new IndexEnumerator(this);
}
Expand Down Expand Up @@ -55,7 +58,7 @@ bool ICollection<T>.Remove(T item)
}

public int Count => Length;
public bool IsReadOnly => false;
bool ICollection<T>.IsReadOnly => false;

public int IndexOf(T item)
{
Expand Down

0 comments on commit 902afb4

Please sign in to comment.