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