This commit is contained in:
erik 2025-06-09 02:03:11 +02:00
parent 01151e679b
commit 57b2f0400e
265 changed files with 22828 additions and 6 deletions

View file

@ -0,0 +1,33 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
namespace Decal.Adapter.Wrappers;
public sealed class IndexedCollection<InternalIndexType, IndexType, RType> : MarshalByRefObject, IEnumerable<RType>, IEnumerable where InternalIndexType : struct, IConvertible where IndexType : struct, IConvertible
{
private InternalIndexType myDataType;
private IIndexedProvider<InternalIndexType> myWrap;
public RType this[IndexType index] => (RType)myWrap.GetIndexedObject(myDataType, index.ToInt32(CultureInfo.InvariantCulture));
public int Count => myWrap.Count(myDataType);
internal IndexedCollection(IIndexedProvider<InternalIndexType> wrap, InternalIndexType data)
{
myDataType = data;
myWrap = wrap;
}
IEnumerator<RType> IEnumerable<RType>.GetEnumerator()
{
return (IEnumerator<RType>)myWrap.GetEnumerator(myDataType);
}
IEnumerator IEnumerable.GetEnumerator()
{
return myWrap.GetEnumerator(myDataType);
}
}