daily update on 20250210 by nitload youmu

This commit is contained in:
Nitload
2025-02-10 12:48:02 +08:00
parent ae94c265ae
commit c23b640cae
70 changed files with 2135 additions and 805 deletions
@@ -0,0 +1,78 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Collections
{
/// <summary>
/// Part of a collection. This contains a direct reference to origin collection,
/// so all change to origin collection will be reflected in this object.
/// </summary>
/// <typeparam name="T"></typeparam>
public class ReferencedSlicedCollection<T> : ICollection<T>
{
private ICollection<T> _collection;
private int _begin;
private int _length;
internal ReferencedSlicedCollection()
{
_collection = Array.Empty<T>();
_begin = 0;
_length = 0;
}
public ReferencedSlicedCollection(ICollection<T> collection, int begin, int length)
{
ArgumentNullException.ThrowIfNull(collection);
ArgumentOutOfRangeException.ThrowIfLessThan(begin, 0);
ArgumentOutOfRangeException.ThrowIfLessThan(length, 0);
ArgumentOutOfRangeException.ThrowIfLessThan(begin + length, collection.Count);
_collection = collection;
_begin = begin;
_length = length;
}
public int Count => _length;
public bool IsReadOnly => true;
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Contains(T item)
{
throw new NotImplementedException();
}
public void CopyTo(T[] array, int arrayIndex)
{
throw new NotImplementedException();
}
public IEnumerator<T> GetEnumerator()
{
throw new NotImplementedException();
}
public bool Remove(T item)
{
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
}
}