diff --git a/Recyclable.Collections/RecyclableCollectionVersion.cs b/Recyclable.Collections/RecyclableCollectionVersion.cs deleted file mode 100644 index 829e1a1..0000000 --- a/Recyclable.Collections/RecyclableCollectionVersion.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Runtime.CompilerServices; - -namespace Recyclable.Collections -{ - public delegate void VersionChangedEventHandler(); - - public sealed class RecyclableCollectionVersion - { - //private ulong _enumeratorCount; - - //private ulong _version; - //public ulong Version - //{ - // get => _version; - - // set - // { - // _version = value; - // _versionChanged?.Invoke(this, EventArgs.Empty); - // } - //} - - //public uint Version { get; set; } - - public bool IsVersioned; - - private VersionChangedEventHandler? _versionChanged; - public event VersionChangedEventHandler VersionChanged - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - add - { - _versionChanged += value; - if (!IsVersioned) - { - IsVersioned = true; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - remove - { - _versionChanged -= value; - if (_versionChanged == null) - { - IsVersioned = false; - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Inc() - { - if (IsVersioned) - { - _versionChanged!(); - } - //_ = unchecked(Version++); - } - - //[MethodImpl(MethodImplOptions.AggressiveInlining)] - //public RecyclableCollectionVersion AddEnumerator() - //{ - // if (unchecked(_enumeratorCount++) == 0) - // { - // IsVersioned = true; - // } - - // return this; - //} - - //[MethodImpl(MethodImplOptions.AggressiveInlining)] - //public void RemoveEnumerator() - //{ - // if (unchecked(--_enumeratorCount) == 0) - // { - // IsVersioned = false; - // } - //} - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public RecyclableCollectionVersion Reset() - { - IsVersioned = false; - //Version = 0; - //_enumeratorCount = 0; - return this; - } - } -} diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index 785cc2f..9fde854 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -1,5 +1,4 @@ -using Recyclable.Collections.Pools; -using System.Buffers; +using System.Buffers; using System.Collections; using System.Runtime.CompilerServices; diff --git a/Recyclable.Collections/ThrowHelper.cs b/Recyclable.Collections/ThrowHelper.cs index 9d4f218..8779ce6 100644 --- a/Recyclable.Collections/ThrowHelper.cs +++ b/Recyclable.Collections/ThrowHelper.cs @@ -4,31 +4,11 @@ namespace Recyclable.Collections { internal static class ThrowHelper { - /// - /// This is a helper method to throw , thrown when the collection was modified during enumeration. - /// - /// Always - public static void ThrowListModifiedException() - { - Contract.EnsuresOnThrow(false); - throw new InvalidOperationException("Can't move to the next item, because the collection was modified. You must restart the enumeration by calling Reset(), if you want to enumerate the collection again"); - } - - /// - /// This is a helper method to throw with the given message. - /// - /// Always - public static void ThrowInvalidOperationException(in string message) - { - Contract.EnsuresOnThrow(false); - throw new InvalidOperationException(message); - } - /// /// This is a helper method to throw with the given message. /// /// Always - public static void ThrowArgumentOutOfRangeException(in string argumentName, in string message) + public static void ThrowArgumentOutOfRangeException(string argumentName, string message) { Contract.EnsuresOnThrow(false); throw new ArgumentOutOfRangeException(argumentName, message);