diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c4fff4b2..ebd1c2f2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,10 @@ --- version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "daily" + interval: daily - package-ecosystem: nuget directory: / diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e7e2e855..17d73e31 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,22 +15,22 @@ on: workflow_dispatch: env: - RESOURCE_GROUP_NAME: ondfisk - WEBAPP_NAME: c5 BUILD_CONFIGURATION: Release jobs: build: name: Build & Test + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.1.0 + - name: Checkout + uses: actions/checkout@v4 - name: Setup - uses: actions/setup-dotnet@v4.0.0 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore run: dotnet restore @@ -39,37 +39,36 @@ jobs: run: dotnet build --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore - name: Test - run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover + run: dotnet test --configuration ${{ env.BUILD_CONFIGURATION }} --no-build - - uses: actions/upload-artifact@v3 + - name: Upload artifact + uses: actions/upload-artifact@v4 with: name: lib path: bin/**/*.nupkg - documentation: - name: Generate Documentation + deploy: + name: Deploy + runs-on: ubuntu-latest - container: - image: corentinaltepe/doxygen - steps: - - uses: actions/checkout@v3.1.0 + permissions: + packages: write + contents: read + issues: read + checks: write + pull-requests: write - - name: Install GraphViz - run: apk update && apk add graphviz font-bitstream-type1 ghostscript-fonts + if: ${{ github.ref == 'refs/heads/master' }} - - name: Generate Documentation - run: doxygen Doxyfile + needs: + - build - - uses: actions/upload-artifact@v3 + steps: + - name: Download artifact + uses: actions/download-artifact@v4 with: - name: docs - path: docs/ - - # deploy: - # name: Deploy - # runs-on: ubuntu-latest - # if: ${{ github.ref == 'refs/heads/master' }} - # needs: - # - build - # environment: Production + name: lib + + - name: Push package to GitHub packages + run: dotnet nuget push ./**/*.nupkg --source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" --api-key ${{ secrets.GITHUB_TOKEN }} diff --git a/C5.Tests/ArrayListTests.cs b/C5.Tests/ArrayListTests.cs deleted file mode 100644 index 8f853b50..00000000 --- a/C5.Tests/ArrayListTests.cs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of the C5 Generic Collection Library for C# and CLI -// See https://github.com/sestoft/C5/blob/master/LICENSE for licensing details. - -using NUnit.Framework; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; - -namespace C5.Tests -{ - [TestFixture] - public class ArrayListTests - { - [Test] - public void Serialize() - { - var source = new ArrayList(); - source.AddAll(new[] { 1, 2, 3, 4, 5 }); - - ArrayList target; - var formatter = new BinaryFormatter(); - using (var stream = new MemoryStream()) - { - formatter.Serialize(stream, source); - stream.Position = 0; - - target = (ArrayList)formatter.Deserialize(stream); - } - - CollectionAssert.AreEqual(source, target); - } - } -} diff --git a/C5.Tests/Arrays/ArrayListTest.cs b/C5.Tests/Arrays/ArrayListTest.cs index b66e4705..06aef00e 100644 --- a/C5.Tests/Arrays/ArrayListTest.cs +++ b/C5.Tests/Arrays/ArrayListTest.cs @@ -2249,10 +2249,10 @@ public void DirectionAndCount() lst.Add(i); } - Assert.AreEqual(EnumerationDirection.Forwards, lst.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, lst[3, 4].Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst[3, 4].Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, lst.Direction); + Assert.AreEqual(Direction.Forwards, lst[3, 4].Direction); + Assert.AreEqual(Direction.Backwards, lst[3, 4].Backwards().Direction); + Assert.AreEqual(Direction.Backwards, lst.Backwards().Direction); Assert.AreEqual(4, lst[3, 4].Count); Assert.AreEqual(4, lst[3, 4].Backwards().Count); Assert.AreEqual(10, lst.Backwards().Count); @@ -2462,8 +2462,8 @@ public void Bxxx() Assert.IsTrue(IC.Eq(view.Backwards(), 2, 1)); Assert.AreSame(list, view.Underlying); Assert.IsNull(list.Underlying); - Assert.AreEqual(EnumerationDirection.Forwards, view.Direction); - Assert.AreEqual(EnumerationDirection.Backwards, view.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, view.Direction); + Assert.AreEqual(Direction.Backwards, view.Backwards().Direction); Assert.AreEqual(0, list.Offset); Assert.AreEqual(1, view.Offset); } diff --git a/C5.Tests/Arrays/HashedArrayListTest.cs b/C5.Tests/Arrays/HashedArrayListTest.cs index 56c096b9..a8205be2 100644 --- a/C5.Tests/Arrays/HashedArrayListTest.cs +++ b/C5.Tests/Arrays/HashedArrayListTest.cs @@ -2060,10 +2060,10 @@ public void DirectionAndCount() lst.Add(i); } - Assert.AreEqual(EnumerationDirection.Forwards, lst.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, lst[3, 4].Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst[3, 4].Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, lst.Direction); + Assert.AreEqual(Direction.Forwards, lst[3, 4].Direction); + Assert.AreEqual(Direction.Backwards, lst[3, 4].Backwards().Direction); + Assert.AreEqual(Direction.Backwards, lst.Backwards().Direction); Assert.AreEqual(4, lst[3, 4].Count); Assert.AreEqual(4, lst[3, 4].Backwards().Count); Assert.AreEqual(10, lst.Backwards().Count); @@ -2284,8 +2284,8 @@ public void Bxxx() Assert.IsTrue(IC.Eq(view.Backwards(), 2, 1)); Assert.AreSame(list, view.Underlying); Assert.IsNull(list.Underlying); - Assert.AreEqual(EnumerationDirection.Forwards, view.Direction); - Assert.AreEqual(EnumerationDirection.Backwards, view.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, view.Direction); + Assert.AreEqual(Direction.Backwards, view.Backwards().Direction); Assert.AreEqual(0, list.Offset); Assert.AreEqual(1, view.Offset); } diff --git a/C5.Tests/Arrays/SortedArrayTests.cs b/C5.Tests/Arrays/SortedArrayTests.cs index 030b3de6..9d942a58 100644 --- a/C5.Tests/Arrays/SortedArrayTests.cs +++ b/C5.Tests/Arrays/SortedArrayTests.cs @@ -205,16 +205,16 @@ public void Backwards() [Test] public void Direction() { - Assert.AreEqual(EnumerationDirection.Forwards, array.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, array.RangeFrom(20).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, array.RangeTo(7).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, array.RangeFromTo(1, 12).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, array.RangeAll().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, array.Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, array.RangeFrom(20).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, array.RangeTo(7).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, array.RangeFromTo(1, 12).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, array.RangeAll().Backwards().Direction); + Assert.AreEqual(C5.Direction.Forwards, array.Direction); + Assert.AreEqual(C5.Direction.Forwards, array.RangeFrom(20).Direction); + Assert.AreEqual(C5.Direction.Forwards, array.RangeTo(7).Direction); + Assert.AreEqual(C5.Direction.Forwards, array.RangeFromTo(1, 12).Direction); + Assert.AreEqual(C5.Direction.Forwards, array.RangeAll().Direction); + Assert.AreEqual(C5.Direction.Backwards, array.Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, array.RangeFrom(20).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, array.RangeTo(7).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, array.RangeFromTo(1, 12).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, array.RangeAll().Backwards().Direction); } diff --git a/C5.Tests/C5.Tests.csproj b/C5.Tests/C5.Tests.csproj index 2b8e3923..c9b2ef77 100644 --- a/C5.Tests/C5.Tests.csproj +++ b/C5.Tests/C5.Tests.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 false enable latest @@ -12,7 +12,7 @@ all - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/C5.Tests/LinkedLists/HashedLinkedListTest.cs b/C5.Tests/LinkedLists/HashedLinkedListTest.cs index 63e654fd..83846855 100644 --- a/C5.Tests/LinkedLists/HashedLinkedListTest.cs +++ b/C5.Tests/LinkedLists/HashedLinkedListTest.cs @@ -1578,10 +1578,10 @@ public void DirectionAndCount() lst.Add(i); } - Assert.AreEqual(EnumerationDirection.Forwards, lst.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, lst[3, 7].Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst[3, 7].Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, lst.Direction); + Assert.AreEqual(Direction.Forwards, lst[3, 7].Direction); + Assert.AreEqual(Direction.Backwards, lst[3, 7].Backwards().Direction); + Assert.AreEqual(Direction.Backwards, lst.Backwards().Direction); Assert.AreEqual(4, lst[3, 4].Count); Assert.AreEqual(4, lst[3, 4].Backwards().Count); Assert.AreEqual(10, lst.Backwards().Count); @@ -1790,8 +1790,8 @@ public void Bxxx() Assert.IsTrue(IC.Eq(view.Backwards(), 2, 1)); Assert.AreSame(list, view.Underlying); Assert.IsNull(list.Underlying); - Assert.AreEqual(EnumerationDirection.Forwards, view.Direction); - Assert.AreEqual(EnumerationDirection.Backwards, view.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, view.Direction); + Assert.AreEqual(Direction.Backwards, view.Backwards().Direction); Assert.AreEqual(0, list.Offset); Assert.AreEqual(1, view.Offset); } diff --git a/C5.Tests/LinkedLists/LinkedListTest.cs b/C5.Tests/LinkedLists/LinkedListTest.cs index 3cf395fb..15dbff0f 100644 --- a/C5.Tests/LinkedLists/LinkedListTest.cs +++ b/C5.Tests/LinkedLists/LinkedListTest.cs @@ -1610,10 +1610,10 @@ public void DirectionAndCount() lst.Add(i); } - Assert.AreEqual(EnumerationDirection.Forwards, lst.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, lst[3, 7].Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst[3, 7].Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, lst.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, lst.Direction); + Assert.AreEqual(Direction.Forwards, lst[3, 7].Direction); + Assert.AreEqual(Direction.Backwards, lst[3, 7].Backwards().Direction); + Assert.AreEqual(Direction.Backwards, lst.Backwards().Direction); Assert.AreEqual(4, lst[3, 4].Count); Assert.AreEqual(4, lst[3, 4].Backwards().Count); Assert.AreEqual(10, lst.Backwards().Count); @@ -1826,8 +1826,8 @@ public void Bxxx() Assert.IsTrue(IC.Eq(view.Backwards(), 2, 1)); Assert.AreSame(list, view.Underlying); Assert.IsNull(list.Underlying); - Assert.AreEqual(EnumerationDirection.Forwards, view.Direction); - Assert.AreEqual(EnumerationDirection.Backwards, view.Backwards().Direction); + Assert.AreEqual(Direction.Forwards, view.Direction); + Assert.AreEqual(Direction.Backwards, view.Backwards().Direction); Assert.AreEqual(0, list.Offset); Assert.AreEqual(1, view.Offset); } diff --git a/C5.Tests/Trees/Bag.cs b/C5.Tests/Trees/Bag.cs index 5ae4208e..251a1d29 100644 --- a/C5.Tests/Trees/Bag.cs +++ b/C5.Tests/Trees/Bag.cs @@ -565,16 +565,16 @@ public void Backwards() [Test] public void Direction() { - Assert.AreEqual(EnumerationDirection.Forwards, tree.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeFrom(20).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeTo(7).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeFromTo(1, 12).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeAll().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeFrom(20).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeTo(7).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeFromTo(1, 12).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeAll().Backwards().Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeFrom(20).Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeTo(7).Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeFromTo(1, 12).Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeAll().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeFrom(20).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeTo(7).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeFromTo(1, 12).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeAll().Backwards().Direction); } diff --git a/C5.Tests/Trees/RedBlackTreeSetTests.cs b/C5.Tests/Trees/RedBlackTreeSetTests.cs index 483acd58..1632051f 100644 --- a/C5.Tests/Trees/RedBlackTreeSetTests.cs +++ b/C5.Tests/Trees/RedBlackTreeSetTests.cs @@ -318,16 +318,16 @@ public void Backwards() [Test] public void Direction() { - Assert.AreEqual(EnumerationDirection.Forwards, tree.Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeFrom(20).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeTo(7).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeFromTo(1, 12).Direction); - Assert.AreEqual(EnumerationDirection.Forwards, tree.RangeAll().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeFrom(20).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeTo(7).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeFromTo(1, 12).Backwards().Direction); - Assert.AreEqual(EnumerationDirection.Backwards, tree.RangeAll().Backwards().Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeFrom(20).Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeTo(7).Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeFromTo(1, 12).Direction); + Assert.AreEqual(C5.Direction.Forwards, tree.RangeAll().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeFrom(20).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeTo(7).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeFromTo(1, 12).Backwards().Direction); + Assert.AreEqual(C5.Direction.Backwards, tree.RangeAll().Backwards().Direction); } diff --git a/C5.Tests/WrappersTest.cs b/C5.Tests/WrappersTest.cs index 2ed86f0f..1f0ae84e 100644 --- a/C5.Tests/WrappersTest.cs +++ b/C5.Tests/WrappersTest.cs @@ -596,7 +596,7 @@ public void NoExc() Assert.IsTrue(IC.Eq(extarray, 0, 4, 6, 5, 0)); Assert.AreEqual(3, wrapped.Count); Assert.AreEqual(Speed.Constant, wrapped.CountSpeed); - Assert.AreEqual(EnumerationDirection.Forwards, wrapped.Direction); + Assert.AreEqual(Direction.Forwards, wrapped.Direction); Assert.AreEqual(false, wrapped.DuplicatesByCounting); Assert.AreEqual(System.Collections.Generic.EqualityComparer.Default, wrapped.EqualityComparer); Assert.AreEqual(true, wrapped.Exists(is4)); @@ -718,7 +718,7 @@ public void View() Assert.IsTrue(IC.Eq(extarray, 0, 4, 6, 5, 0)); Assert.AreEqual(3, wrapped.Count); Assert.AreEqual(Speed.Constant, wrapped.CountSpeed); - Assert.AreEqual(EnumerationDirection.Forwards, wrapped.Direction); + Assert.AreEqual(Direction.Forwards, wrapped.Direction); Assert.AreEqual(false, wrapped.DuplicatesByCounting); Assert.AreEqual(System.Collections.Generic.EqualityComparer.Default, wrapped.EqualityComparer); Assert.AreEqual(true, wrapped.Exists(is4)); diff --git a/C5.UserGuideExamples/C5.UserGuideExamples.csproj b/C5.UserGuideExamples/C5.UserGuideExamples.csproj index 23a2b178..5508034c 100644 --- a/C5.UserGuideExamples/C5.UserGuideExamples.csproj +++ b/C5.UserGuideExamples/C5.UserGuideExamples.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 false enable latest diff --git a/C5.UserGuideExamples/SerializationExample.cs b/C5.UserGuideExamples/SerializationExample.cs deleted file mode 100644 index e8409dad..00000000 --- a/C5.UserGuideExamples/SerializationExample.cs +++ /dev/null @@ -1,48 +0,0 @@ -// This file is part of the C5 Generic Collection Library for C# and CLI -// See https://github.com/sestoft/C5/blob/master/LICENSE for licensing details. - -// C5 example: serialization and deserialization - -namespace C5.UserGuideExamples; - -internal class SerializationExample -{ - private static readonly BinaryFormatter _formatter = new BinaryFormatter(); - - public static void ToFile(IExtensible coll, string filename) - { - using (var stream = new FileStream(filename, FileMode.OpenOrCreate)) - { - _formatter.Serialize(stream, coll); - } - } - - public static T FromFile(string filename) - { - using (var stream = new FileStream(filename, FileMode.Open)) - { - return (T)_formatter.Deserialize(stream); - } - } - - public static void Main() - { - var names = new LinkedList(); - var reagan = "Reagan"; - names.AddAll(new string[] { reagan, reagan, "Bush", "Clinton", "Clinton", "Bush", "Bush" }); - ToFile(names, "prez.bin"); - var namesFromFile = FromFile>("prez.bin"); - - foreach (var s in namesFromFile) - { - Console.WriteLine(s); - } - - Console.Write("Deserialization preserves sequenced equality: "); - Console.WriteLine(names.SequencedEquals(namesFromFile)); - Console.Write("Deserialization reuses the same strings: "); - Console.WriteLine(ReferenceEquals(reagan, namesFromFile[1])); - Console.Write("Deserialization preserves sharing: "); - Console.WriteLine(ReferenceEquals(namesFromFile[0], namesFromFile[1])); - } -} diff --git a/C5/Arrays/ArrayList.cs b/C5/Arrays/ArrayList.cs index 0b3bd73b..1bd02502 100644 --- a/C5/Arrays/ArrayList.cs +++ b/C5/Arrays/ArrayList.cs @@ -14,7 +14,6 @@ namespace C5 /// When the FIFO property is set to true the class will function as a (FIFO) queue /// but very inefficiently, use a LinkedList () instead. /// - [Serializable] public class ArrayList : ArrayBase, IList, IStack, IQueue { #region Fields @@ -541,7 +540,6 @@ private void DisposeOverlappingViews(bool reverse) #endregion #region Position, PositionComparer and ViewHandler nested types - [Serializable] private class PositionComparer : SCG.IComparer { public int Compare(Position a, Position b) diff --git a/C5/Arrays/CircularQueue.cs b/C5/Arrays/CircularQueue.cs index abfaf9c0..415dfebd 100644 --- a/C5/Arrays/CircularQueue.cs +++ b/C5/Arrays/CircularQueue.cs @@ -9,7 +9,6 @@ namespace C5 /// /// /// - [Serializable] public class CircularQueue : SequencedBase, IQueue, IStack { #region Fields diff --git a/C5/Arrays/HashedArrayList.cs b/C5/Arrays/HashedArrayList.cs index ab381c2b..13fe0ea9 100644 --- a/C5/Arrays/HashedArrayList.cs +++ b/C5/Arrays/HashedArrayList.cs @@ -15,7 +15,6 @@ namespace C5 /// When the FIFO property is set to true the class will function as a (FIFO) queue /// but very inefficiently, use a LinkedList () instead. /// - [Serializable] public class HashedArrayList : ArrayBase, IList, SCG.IList { #region Fields @@ -550,7 +549,6 @@ private void DisposeOverlappingViews(bool reverse) #endregion #region Position, PositionComparer and ViewHandler nested types - [Serializable] private class PositionComparer : SCG.IComparer { public int Compare(Position a, Position b) diff --git a/C5/Arrays/SortedArray.cs b/C5/Arrays/SortedArray.cs index 52685060..af0a5182 100644 --- a/C5/Arrays/SortedArray.cs +++ b/C5/Arrays/SortedArray.cs @@ -8,7 +8,6 @@ namespace C5 /// /// A collection class implementing a sorted dynamic array data structure. /// - [Serializable] public class SortedArray : ArrayBase, IIndexedSorted { #region Events diff --git a/C5/BaseClasses/ArrayBase.cs b/C5/BaseClasses/ArrayBase.cs index c6873581..6b0a0fe3 100644 --- a/C5/BaseClasses/ArrayBase.cs +++ b/C5/BaseClasses/ArrayBase.cs @@ -5,7 +5,6 @@ namespace C5 /// /// Base class for collection classes of dynamic array type implementations. /// - [Serializable] public abstract class ArrayBase : SequencedBase { #region Fields @@ -214,7 +213,6 @@ public override System.Collections.Generic.IEnumerator GetEnumerator() /// /// A helper class for defining results of interval queries on array based collections. /// - [Serializable] protected class Range : DirectedCollectionValueBase, IDirectedCollectionValue { private int start; @@ -318,12 +316,12 @@ IDirectedEnumerable C5.IDirectedEnumerable.Backwards() /// /// if underlying collection has been modified. /// The enumeration direction relative to the original collection. - public override EnumerationDirection Direction + public override Direction Direction { get { thebase.ModifyCheck(stamp); - return delta > 0 ? EnumerationDirection.Forwards : EnumerationDirection.Backwards; + return delta > 0 ? Direction.Forwards : Direction.Backwards; } } } diff --git a/C5/BaseClasses/CollectionBase.cs b/C5/BaseClasses/CollectionBase.cs index 0ecef724..c539457c 100644 --- a/C5/BaseClasses/CollectionBase.cs +++ b/C5/BaseClasses/CollectionBase.cs @@ -5,7 +5,6 @@ namespace C5 /// /// Base class (abstract) for ICollection implementations. /// - [Serializable] public abstract class CollectionBase : CollectionValueBase { #region Fields diff --git a/C5/BaseClasses/CollectionValueBase.cs b/C5/BaseClasses/CollectionValueBase.cs index 8b548e22..03b84882 100644 --- a/C5/BaseClasses/CollectionValueBase.cs +++ b/C5/BaseClasses/CollectionValueBase.cs @@ -5,7 +5,6 @@ namespace C5 /// /// Base class for classes implementing ICollectionValue[T] /// - [Serializable] public abstract class CollectionValueBase : EnumerableBase, ICollectionValue, IShowable { #region Event handling @@ -354,7 +353,6 @@ protected virtual void RaiseForRemoveAll(ICollectionValue? wasRemoved) /// /// /// - [Serializable] protected class RaiseForRemoveAllHandler { private readonly CollectionValueBase collection; diff --git a/C5/BaseClasses/DictionaryBase.cs b/C5/BaseClasses/DictionaryBase.cs index 7f226939..757a9d24 100644 --- a/C5/BaseClasses/DictionaryBase.cs +++ b/C5/BaseClasses/DictionaryBase.cs @@ -8,7 +8,6 @@ namespace C5 /// See the source code for for an example /// /// - [Serializable] public abstract class DictionaryBase : CollectionValueBase>, IDictionary { /// @@ -206,7 +205,6 @@ public virtual bool Contains(K key) return pairs.Contains(p); } - [Serializable] private class LiftedEnumerable : IEnumerable> where H : K { private readonly System.Collections.Generic.IEnumerable keys; @@ -350,10 +348,7 @@ public virtual bool UpdateOrAdd(K key, V value, out V oldvalue) return retval; } - - #region Keys,Values support classes - [Serializable] internal class ValuesCollection : CollectionValueBase, ICollectionValue { private readonly ICollection> pairs; @@ -381,7 +376,6 @@ public override System.Collections.Generic.IEnumerator GetEnumerator() public override Speed CountSpeed => Speed.Constant; } - [Serializable] internal class KeysCollection : CollectionValueBase, ICollectionValue { private readonly ICollection> pairs; diff --git a/C5/BaseClasses/DirectedCollectionBase.cs b/C5/BaseClasses/DirectedCollectionBase.cs index bca0af75..47087631 100644 --- a/C5/BaseClasses/DirectedCollectionBase.cs +++ b/C5/BaseClasses/DirectedCollectionBase.cs @@ -6,7 +6,6 @@ namespace C5 /// /// /// - [Serializable] public abstract class DirectedCollectionBase : CollectionBase, IDirectedCollectionValue { /// @@ -18,7 +17,7 @@ protected DirectedCollectionBase(System.Collections.Generic.IEqualityComparer /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - public virtual EnumerationDirection Direction => EnumerationDirection.Forwards; + public virtual Direction Direction => Direction.Forwards; /// /// diff --git a/C5/BaseClasses/DirectedCollectionValueBase.cs b/C5/BaseClasses/DirectedCollectionValueBase.cs index 7bc4417a..3a2729ce 100644 --- a/C5/BaseClasses/DirectedCollectionValueBase.cs +++ b/C5/BaseClasses/DirectedCollectionValueBase.cs @@ -6,14 +6,13 @@ namespace C5 /// /// /// - [Serializable] public abstract class DirectedCollectionValueBase : CollectionValueBase, IDirectedCollectionValue { /// /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - public virtual EnumerationDirection Direction => EnumerationDirection.Forwards; + public virtual Direction Direction => Direction.Forwards; /// /// diff --git a/C5/BaseClasses/EnumerableBase.cs b/C5/BaseClasses/EnumerableBase.cs index 03eec9ed..50614c8c 100644 --- a/C5/BaseClasses/EnumerableBase.cs +++ b/C5/BaseClasses/EnumerableBase.cs @@ -8,7 +8,6 @@ namespace C5 /// /// A base class for implementing an IEnumerable<T> /// - [Serializable] public abstract class EnumerableBase : SCG.IEnumerable { /// diff --git a/C5/BaseClasses/SequencedBase.cs b/C5/BaseClasses/SequencedBase.cs index e30c269f..e88764ce 100644 --- a/C5/BaseClasses/SequencedBase.cs +++ b/C5/BaseClasses/SequencedBase.cs @@ -5,7 +5,6 @@ namespace C5 /// /// Base class (abstract) for sequenced collection implementations. /// - [Serializable] public abstract class SequencedBase : DirectedCollectionBase, IDirectedCollectionValue { #region Fields @@ -135,7 +134,7 @@ public virtual bool SequencedEquals(ISequenced otherCollection) /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - public override EnumerationDirection Direction => EnumerationDirection.Forwards; + public override Direction Direction => Direction.Forwards; /// /// Check if there exists an item that satisfies a diff --git a/C5/C5.csproj b/C5/C5.csproj index 4ff711bc..a632d852 100644 --- a/C5/C5.csproj +++ b/C5/C5.csproj @@ -1,9 +1,9 @@  - netstandard2.0;net6.0 + netstandard2.0;net6.0;net8.0 enable latest - 3.0.0-rc + 3.0.0 Copyright © Niels Kokholm, Peter Sestoft, and Rasmus Lystrøm 2003-2021 Niels Kokholm, Peter Sestoft, and Rasmus Lystrøm The C5 Generic Collection Library for C# and CLI is a comprehensive collection library supporting lists, sets, bags, dictionaries, priority queues, (FIFO) queues, and (LIFO) stacks. C5 runs on everything supporting .NET Standard 2.0: .NET Core 2.0+, .NET 4.6.1+, Mono, Xamarin, Universal Windows Platform, and Unity. @@ -13,16 +13,15 @@ https://www.itu.dk/research/c5/ . - - Strong name removed. - - Memory safe optimizer removed as they are no longer needed for Unity development. - - `Rec` type removed as was an exact copy of `ValueTuple`. - - Breaking change: All `public readonly` are now properties. - - Breaking change: `EventTypeEnum` is now `EventType`. - - Breaking change: custom `KeyValuePair` has been replaced by the standard `System.Collections.Generic.KeyValue` for better compatability. - - Deprecation warning: As per [BinaryFormatter security guide](https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide), binary deserialization present high security risk. For this reason the `[Serializable]` attribute will be removed from the entire library in the next release. + Release 3.0.0 of 2024-06-06 + + - C5 now targets .NET Standard 2.0, .NET 6.0 and .NET 8.0. + - Breaking change: `Rec` type removed as it was an exact copy of `ValueTuple`. + - Breaking change: All `public readonly` are now properties. + - Breaking change: `EventTypeEnum` is now `EventType`. + - Breaking change: custom `KeyValuePair` has been replaced by the standard `System.Collections.Generic.KeyValue` for better compatibility. + - Breaking change: `EnumerationDirection` is now `Direction`. + - `[Serializable]` attribute removed. Cf. [BinaryFormatter security guide](https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide). ]]> MIT diff --git a/C5/C5Random.cs b/C5/C5Random.cs index dd991228..b5e2a15a 100644 --- a/C5/C5Random.cs +++ b/C5/C5Random.cs @@ -10,7 +10,6 @@ namespace C5 /// ACM 46, 5 (May 2003) 90-93; and a posting by Marsaglia to /// comp.lang.c on 2003-04-03. /// - [Serializable] public class C5Random : Random { private readonly uint[] Q = new uint[16]; diff --git a/C5/Comparers/ComparerZeroHashCodeEqualityComparer.cs b/C5/Comparers/ComparerZeroHashCodeEqualityComparer.cs index fbabb9d5..4e7be8b2 100644 --- a/C5/Comparers/ComparerZeroHashCodeEqualityComparer.cs +++ b/C5/Comparers/ComparerZeroHashCodeEqualityComparer.cs @@ -12,7 +12,6 @@ namespace C5 /// Note: this will give a new EqualityComparer each time created! /// /// - [Serializable] internal class ComparerZeroHashCodeEqualityComparer : SCG.IEqualityComparer { private readonly SCG.IComparer comparer; diff --git a/C5/Comparers/EqualityComparer.cs b/C5/Comparers/EqualityComparer.cs index 84cbcda5..26dbd2ed 100644 --- a/C5/Comparers/EqualityComparer.cs +++ b/C5/Comparers/EqualityComparer.cs @@ -12,7 +12,6 @@ namespace C5 /// Utility class for building default generic equality comparers. /// /// - [Serializable] public static class EqualityComparer { private static SCG.IEqualityComparer _default; diff --git a/C5/Comparers/InternalComparer.cs b/C5/Comparers/InternalComparer.cs index 92be1322..14717c0e 100644 --- a/C5/Comparers/InternalComparer.cs +++ b/C5/Comparers/InternalComparer.cs @@ -11,7 +11,6 @@ namespace C5 /// This class is intentionally declared internal - use the ComparerFactory to create an instance. /// /// The type of objects to compare. - [Serializable] internal class InternalComparer : IComparer { private readonly Func _compare; diff --git a/C5/Comparers/InternalEqualityComparer.cs b/C5/Comparers/InternalEqualityComparer.cs index 879ca2d6..93034ba7 100644 --- a/C5/Comparers/InternalEqualityComparer.cs +++ b/C5/Comparers/InternalEqualityComparer.cs @@ -11,7 +11,6 @@ namespace C5 /// This class is intentionally declared internal - use the ComparerFactory to create an instance. /// /// The type of objects to compare. - [Serializable] internal class InternalEqualityComparer : IEqualityComparer { private readonly Func _equals; diff --git a/C5/Comparers/KeyValuePairComparer.cs b/C5/Comparers/KeyValuePairComparer.cs index 163b0106..37851fd5 100644 --- a/C5/Comparers/KeyValuePairComparer.cs +++ b/C5/Comparers/KeyValuePairComparer.cs @@ -7,7 +7,6 @@ namespace C5 /// Default comparer for dictionary entries in a sorted dictionary. /// Entry comparisons only look at keys and uses an externally defined comparer for that. /// - [Serializable] public class KeyValuePairComparer : IComparer> { private readonly System.Collections.Generic.IComparer comparer; diff --git a/C5/Comparers/KeyValuePairEqualityComparer.cs b/C5/Comparers/KeyValuePairEqualityComparer.cs index 2ef23dc4..d90b1cbe 100644 --- a/C5/Comparers/KeyValuePairEqualityComparer.cs +++ b/C5/Comparers/KeyValuePairEqualityComparer.cs @@ -7,7 +7,6 @@ namespace C5 /// Default equalityComparer for dictionary entries. /// Operations only look at keys and uses an externally defined equalityComparer for that. /// - [Serializable] public sealed class KeyValuePairEqualityComparer : IEqualityComparer> { private readonly System.Collections.Generic.IEqualityComparer keyequalityComparer; diff --git a/C5/Comparers/SequencedCollectionEqualityComparer.cs b/C5/Comparers/SequencedCollectionEqualityComparer.cs index f1afcccf..304bb2b1 100644 --- a/C5/Comparers/SequencedCollectionEqualityComparer.cs +++ b/C5/Comparers/SequencedCollectionEqualityComparer.cs @@ -9,7 +9,6 @@ namespace C5 /// /// /// - [Serializable] public class SequencedCollectionEqualityComparer : IEqualityComparer where T : ISequenced { diff --git a/C5/Comparers/UnsequencedCollectionEqualityComparer.cs b/C5/Comparers/UnsequencedCollectionEqualityComparer.cs index 2d2d2c6d..09fe8174 100644 --- a/C5/Comparers/UnsequencedCollectionEqualityComparer.cs +++ b/C5/Comparers/UnsequencedCollectionEqualityComparer.cs @@ -9,7 +9,6 @@ namespace C5 /// /// /// - [Serializable] public class UnsequencedCollectionEqualityComparer : IEqualityComparer where T : ICollection { diff --git a/C5/Debug.cs b/C5/Debug.cs index 3c61f040..dee402bc 100644 --- a/C5/Debug.cs +++ b/C5/Debug.cs @@ -8,7 +8,6 @@ namespace C5 /// /// Class containing debugging symbols - to eliminate preprocessor directives /// - [Serializable] internal class Debug { /// diff --git a/C5/Dictionaries/SortedArrayDictionary.cs b/C5/Dictionaries/SortedArrayDictionary.cs index b0796186..f55dd44e 100644 --- a/C5/Dictionaries/SortedArrayDictionary.cs +++ b/C5/Dictionaries/SortedArrayDictionary.cs @@ -2,7 +2,6 @@ namespace C5 { - [Serializable] internal class SortedArrayDictionary : SortedDictionaryBase { #region Constructors diff --git a/C5/Dictionaries/SortedDictionaryBase.cs b/C5/Dictionaries/SortedDictionaryBase.cs index 7f33bcea..c38c6891 100644 --- a/C5/Dictionaries/SortedDictionaryBase.cs +++ b/C5/Dictionaries/SortedDictionaryBase.cs @@ -10,7 +10,6 @@ namespace C5 /// See the source code for for an example /// /// - [Serializable] public abstract class SortedDictionaryBase : DictionaryBase, ISortedDictionary { #region Fields @@ -272,7 +271,6 @@ public void RemoveRangeTo(K highKey) } #endregion - [Serializable] private class KeyValuePairComparable : IComparable> { private readonly IComparable cutter; @@ -284,7 +282,6 @@ private class KeyValuePairComparable : IComparable> public bool Equals(SCG.KeyValuePair other) { return cutter.Equals(other.Key); } } - [Serializable] private class ProjectedDirectedEnumerable : MappedDirectedEnumerable, K> { public ProjectedDirectedEnumerable(IDirectedEnumerable> directedpairs) : base(directedpairs) { } @@ -293,7 +290,6 @@ public ProjectedDirectedEnumerable(IDirectedEnumerable> d } - [Serializable] private class ProjectedDirectedCollectionValue : MappedDirectedCollectionValue, K> { public ProjectedDirectedCollectionValue(IDirectedCollectionValue> directedpairs) : base(directedpairs) { } @@ -302,7 +298,6 @@ public ProjectedDirectedCollectionValue(IDirectedCollectionValue, ISorted { private readonly ISortedDictionary sorteddict; diff --git a/C5/Enumerators/DropMultiplicity.cs b/C5/Enumerators/DropMultiplicity.cs index 4421ab8e..803b40fb 100644 --- a/C5/Enumerators/DropMultiplicity.cs +++ b/C5/Enumerators/DropMultiplicity.cs @@ -2,7 +2,6 @@ namespace C5 { - [Serializable] internal class DropMultiplicity : MappedCollectionValue, K> { public DropMultiplicity(ICollectionValue> coll) : base(coll) { } diff --git a/C5/Enumerators/MappedCollectionValue.cs b/C5/Enumerators/MappedCollectionValue.cs index 61228ba1..f542e95d 100644 --- a/C5/Enumerators/MappedCollectionValue.cs +++ b/C5/Enumerators/MappedCollectionValue.cs @@ -2,7 +2,6 @@ namespace C5 { - [Serializable] internal abstract class MappedCollectionValue : CollectionValueBase { private readonly ICollectionValue collectionValue; diff --git a/C5/Enumerators/MappedDirectedCollectionValue.cs b/C5/Enumerators/MappedDirectedCollectionValue.cs index 3e278c6b..e28ed769 100644 --- a/C5/Enumerators/MappedDirectedCollectionValue.cs +++ b/C5/Enumerators/MappedDirectedCollectionValue.cs @@ -6,7 +6,6 @@ namespace C5 { - [Serializable] internal abstract class MappedDirectedCollectionValue : DirectedCollectionValueBase, IDirectedCollectionValue { private IDirectedCollectionValue directedCollectionValue; @@ -43,7 +42,7 @@ public override SCG.IEnumerator GetEnumerator() } } - public override EnumerationDirection Direction => directedCollectionValue.Direction; + public override Direction Direction => directedCollectionValue.Direction; IDirectedEnumerable IDirectedEnumerable.Backwards() { diff --git a/C5/Enumerators/MappedDirectedEnumerable.cs b/C5/Enumerators/MappedDirectedEnumerable.cs index 4b33e48c..a40261c0 100644 --- a/C5/Enumerators/MappedDirectedEnumerable.cs +++ b/C5/Enumerators/MappedDirectedEnumerable.cs @@ -2,7 +2,6 @@ namespace C5 { - [Serializable] internal abstract class MappedDirectedEnumerable : EnumerableBase, IDirectedEnumerable { private IDirectedEnumerable directedenumerable; @@ -32,6 +31,6 @@ public override System.Collections.Generic.IEnumerator GetEnumerator() } } - public EnumerationDirection Direction => directedenumerable.Direction; + public Direction Direction => directedenumerable.Direction; } } \ No newline at end of file diff --git a/C5/Enumerators/MultiplicityOne.cs b/C5/Enumerators/MultiplicityOne.cs index 0e03c5bf..28ff39d1 100644 --- a/C5/Enumerators/MultiplicityOne.cs +++ b/C5/Enumerators/MultiplicityOne.cs @@ -2,7 +2,6 @@ namespace C5 { - [Serializable] internal class MultiplicityOne : MappedCollectionValue> { public MultiplicityOne(ICollectionValue coll) : base(coll) { } diff --git a/C5/Enums/EnumerationDirection.cs b/C5/Enums/EnumerationDirection.cs index 98b24294..e0a2f7dc 100644 --- a/C5/Enums/EnumerationDirection.cs +++ b/C5/Enums/EnumerationDirection.cs @@ -3,7 +3,7 @@ namespace C5 /// /// Direction of enumeration order relative to original collection. /// - public enum EnumerationDirection + public enum Direction { /// /// Same direction diff --git a/C5/Events/ClearedEventArgs.cs b/C5/Events/ClearedEventArgs.cs index d7553efd..56ac9552 100644 --- a/C5/Events/ClearedEventArgs.cs +++ b/C5/Events/ClearedEventArgs.cs @@ -5,7 +5,6 @@ namespace C5 /// /// /// - [Serializable] public class ClearedEventArgs : EventArgs { /// diff --git a/C5/Events/ClearedRangeEventArgs.cs b/C5/Events/ClearedRangeEventArgs.cs index 66df36c4..4b74a6bc 100644 --- a/C5/Events/ClearedRangeEventArgs.cs +++ b/C5/Events/ClearedRangeEventArgs.cs @@ -5,7 +5,6 @@ namespace C5 /// /// /// - [Serializable] public class ClearedRangeEventArgs : ClearedEventArgs { /// diff --git a/C5/Events/EventBlock.cs b/C5/Events/EventBlock.cs index eb049011..a79338f1 100644 --- a/C5/Events/EventBlock.cs +++ b/C5/Events/EventBlock.cs @@ -9,7 +9,6 @@ namespace C5 /// Holds the real events for a collection /// /// - [Serializable] internal sealed class EventBlock { internal EventType events; diff --git a/C5/Events/ItemAtEventArgs.cs b/C5/Events/ItemAtEventArgs.cs index 7a3e4fe5..edac410f 100644 --- a/C5/Events/ItemAtEventArgs.cs +++ b/C5/Events/ItemAtEventArgs.cs @@ -6,7 +6,6 @@ namespace C5 /// /// /// - [Serializable] public class ItemAtEventArgs : EventArgs { /// diff --git a/C5/Events/ItemCountEventArgs.cs b/C5/Events/ItemCountEventArgs.cs index 60d9bf7b..c6c69b1e 100644 --- a/C5/Events/ItemCountEventArgs.cs +++ b/C5/Events/ItemCountEventArgs.cs @@ -6,7 +6,6 @@ namespace C5 /// /// /// - [Serializable] public class ItemCountEventArgs : EventArgs { /// diff --git a/C5/Events/ProxyEventBlock.cs b/C5/Events/ProxyEventBlock.cs index 8294629c..26b93a3e 100644 --- a/C5/Events/ProxyEventBlock.cs +++ b/C5/Events/ProxyEventBlock.cs @@ -7,7 +7,6 @@ namespace C5 /// This should really be nested in Guarded collection value, only have a guardereal field /// /// - [Serializable] internal sealed class ProxyEventBlock { private readonly ICollectionValue proxy, real; diff --git a/C5/Exceptions/CollectionModifiedException.cs b/C5/Exceptions/CollectionModifiedException.cs index bc35c6f0..f4430d61 100644 --- a/C5/Exceptions/CollectionModifiedException.cs +++ b/C5/Exceptions/CollectionModifiedException.cs @@ -6,7 +6,6 @@ namespace C5 /// An exception thrown by enumerators, range views etc. when accessed after /// the underlying collection has been modified. /// - [Serializable] public class CollectionModifiedException : Exception { /// diff --git a/C5/Exceptions/DuplicateNotAllowedException.cs b/C5/Exceptions/DuplicateNotAllowedException.cs index ff7890d3..a7d67ac2 100644 --- a/C5/Exceptions/DuplicateNotAllowedException.cs +++ b/C5/Exceptions/DuplicateNotAllowedException.cs @@ -10,7 +10,6 @@ namespace C5 /// /// With dictionaries this can happen with the metod. /// - [Serializable] public class DuplicateNotAllowedException : Exception { /// diff --git a/C5/Exceptions/FixedSizeCollectionException.cs b/C5/Exceptions/FixedSizeCollectionException.cs index a88e8bcc..09c2ee29 100644 --- a/C5/Exceptions/FixedSizeCollectionException.cs +++ b/C5/Exceptions/FixedSizeCollectionException.cs @@ -5,7 +5,6 @@ namespace C5 /// /// /// - [Serializable] public class FixedSizeCollectionException : Exception { /// diff --git a/C5/Exceptions/IncompatibleViewException.cs b/C5/Exceptions/IncompatibleViewException.cs index f6e6cda2..c1b4ef5a 100644 --- a/C5/Exceptions/IncompatibleViewException.cs +++ b/C5/Exceptions/IncompatibleViewException.cs @@ -6,7 +6,6 @@ namespace C5 /// An exception thrown by operations on a list that expects an argument /// that is a view on the same underlying list. /// - [Serializable] public class IncompatibleViewException : Exception { /// diff --git a/C5/Exceptions/InternalException.cs b/C5/Exceptions/InternalException.cs index b253b064..5ab94aae 100644 --- a/C5/Exceptions/InternalException.cs +++ b/C5/Exceptions/InternalException.cs @@ -8,7 +8,6 @@ namespace C5 /// /// An exception to throw from library code when an internal inconsistency is encountered. /// - [Serializable] public class InternalException : Exception { internal InternalException(string message) : base(message) { } diff --git a/C5/Exceptions/InvalidPriorityQueueHandleException.cs b/C5/Exceptions/InvalidPriorityQueueHandleException.cs index 46512b03..9abae8a6 100644 --- a/C5/Exceptions/InvalidPriorityQueueHandleException.cs +++ b/C5/Exceptions/InvalidPriorityQueueHandleException.cs @@ -5,7 +5,6 @@ namespace C5 /// /// /// - [Serializable] public class InvalidPriorityQueueHandleException : Exception { /// diff --git a/C5/Exceptions/NoSuchItemException.cs b/C5/Exceptions/NoSuchItemException.cs index 359c377f..55edb12b 100644 --- a/C5/Exceptions/NoSuchItemException.cs +++ b/C5/Exceptions/NoSuchItemException.cs @@ -8,7 +8,6 @@ namespace C5 /// The typical scenario is a lookup by key in a dictionary with an indexer, /// see e.g. /// - [Serializable] public class NoSuchItemException : Exception { /// diff --git a/C5/Exceptions/NotAViewException.cs b/C5/Exceptions/NotAViewException.cs index 130d5841..5ad8c010 100644 --- a/C5/Exceptions/NotAViewException.cs +++ b/C5/Exceptions/NotAViewException.cs @@ -6,7 +6,6 @@ namespace C5 /// An exception thrown by an operation on a list () /// that only makes sense for a view, not for an underlying list. /// - [Serializable] public class NotAViewException : Exception { /// diff --git a/C5/Exceptions/NotComparableException.cs b/C5/Exceptions/NotComparableException.cs index 4cce090f..7e53b83c 100644 --- a/C5/Exceptions/NotComparableException.cs +++ b/C5/Exceptions/NotComparableException.cs @@ -6,7 +6,6 @@ namespace C5 /// An exception thrown by an operation that need to construct a natural /// comparer for a type. /// - [Serializable] public class NotComparableException : Exception { /// diff --git a/C5/Exceptions/ReadOnlyCollectionException.cs b/C5/Exceptions/ReadOnlyCollectionException.cs index 9dcb3bef..486d5169 100644 --- a/C5/Exceptions/ReadOnlyCollectionException.cs +++ b/C5/Exceptions/ReadOnlyCollectionException.cs @@ -8,7 +8,6 @@ namespace C5 /// (method or set property) is called. No check is made to see if the update operation, /// if allowed, would actually change the collection. /// - [Serializable] public class ReadOnlyCollectionException : Exception { /// diff --git a/C5/Exceptions/UnlistenableEventException.cs b/C5/Exceptions/UnlistenableEventException.cs index 90e199cb..3eb30e68 100644 --- a/C5/Exceptions/UnlistenableEventException.cs +++ b/C5/Exceptions/UnlistenableEventException.cs @@ -5,7 +5,6 @@ namespace C5 /// /// /// - [Serializable] public class UnlistenableEventException : Exception { /// diff --git a/C5/Exceptions/ViewDisposedException.cs b/C5/Exceptions/ViewDisposedException.cs index 408c6768..a17317de 100644 --- a/C5/Exceptions/ViewDisposedException.cs +++ b/C5/Exceptions/ViewDisposedException.cs @@ -11,7 +11,6 @@ namespace C5 /// Sort, Reverse or Shuffle on some other, overlapping view or the whole list. /// /// - [Serializable] public class ViewDisposedException : Exception { /// diff --git a/C5/Hashing/HashBag.cs b/C5/Hashing/HashBag.cs index 65381319..eff94695 100644 --- a/C5/Hashing/HashBag.cs +++ b/C5/Hashing/HashBag.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A bag collection based on a hash table of (item,count) pairs. /// - [Serializable] public class HashBag : CollectionBase, ICollection { #region Fields diff --git a/C5/Hashing/HashDictionary.cs b/C5/Hashing/HashDictionary.cs index 5a6a31ea..822d9c70 100644 --- a/C5/Hashing/HashDictionary.cs +++ b/C5/Hashing/HashDictionary.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A generic dictionary class based on a hash set class . /// - [Serializable] public class HashDictionary : DictionaryBase, IDictionary { /// diff --git a/C5/Hashing/HashSet.cs b/C5/Hashing/HashSet.cs index dc409632..676d532e 100644 --- a/C5/Hashing/HashSet.cs +++ b/C5/Hashing/HashSet.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A set collection class based on linear hashing /// - [Serializable] public class HashSet : CollectionBase, ICollection { #region Feature @@ -92,7 +91,6 @@ public enum Feature : short #endregion #region Bucket nested class(es) - [Serializable] private class Bucket { internal T item; diff --git a/C5/Heaps/IntervalHeap.cs b/C5/Heaps/IntervalHeap.cs index 14e960d2..2a3e1f8c 100644 --- a/C5/Heaps/IntervalHeap.cs +++ b/C5/Heaps/IntervalHeap.cs @@ -10,7 +10,6 @@ namespace C5 /// A priority queue class based on an interval heap data structure. /// /// The item type - [Serializable] public class IntervalHeap : CollectionValueBase, IPriorityQueue { #region Events @@ -653,7 +652,6 @@ public bool Check() #region IPriorityQueue Members - [Serializable] private class Handle : IPriorityQueueHandle { /// diff --git a/C5/Interfaces/IDirectedEnumerable.cs b/C5/Interfaces/IDirectedEnumerable.cs index d7d860dd..fbc4d5ba 100644 --- a/C5/Interfaces/IDirectedEnumerable.cs +++ b/C5/Interfaces/IDirectedEnumerable.cs @@ -23,7 +23,7 @@ public interface IDirectedEnumerable : IEnumerable // TODO: Type parameter /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - EnumerationDirection Direction { get; } + Direction Direction { get; } } diff --git a/C5/LinkedLists/HashedLinkedList.cs b/C5/LinkedLists/HashedLinkedList.cs index 111f2d10..3f845d59 100644 --- a/C5/LinkedLists/HashedLinkedList.cs +++ b/C5/LinkedLists/HashedLinkedList.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A list collection class based on a doubly linked list data structure. /// - [Serializable] public class HashedLinkedList : SequencedBase, IList, SCG.IList { #region Fields @@ -580,7 +579,6 @@ public HashedLinkedList() : this(EqualityComparer.Default) { } /// /// An individual cell in the linked list /// - [Serializable] private class Node { public Node? prev; @@ -627,7 +625,6 @@ public override string ToString() /// able to tell the sequence order of two nodes without having to scan through /// the list. /// - [Serializable] private class TagGroup { internal int tag, count; @@ -911,7 +908,6 @@ private void RedistributeTagGroups(TagGroup taggroup) #endregion #region Position, PositionComparer and ViewHandler nested types - [Serializable] private class PositionComparer : SCG.IComparer { private static PositionComparer _default; @@ -1095,7 +1091,6 @@ internal void UpdateSentinels(Node n, Node newstart, Node newend) #region Range nested class - [Serializable] private class Range : DirectedCollectionValueBase, IDirectedCollectionValue { // int start; @@ -1175,7 +1170,7 @@ public override IDirectedCollectionValue Backwards() IDirectedEnumerable IDirectedEnumerable.Backwards() { return Backwards(); } - public override EnumerationDirection Direction => forwards ? EnumerationDirection.Forwards : EnumerationDirection.Backwards; + public override Direction Direction => forwards ? Direction.Forwards : Direction.Backwards; } diff --git a/C5/LinkedLists/LinkedList.cs b/C5/LinkedLists/LinkedList.cs index 660f7c35..12dd6ed5 100644 --- a/C5/LinkedLists/LinkedList.cs +++ b/C5/LinkedLists/LinkedList.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A list collection class based on a doubly linked list data structure. /// - [Serializable] public class LinkedList : SequencedBase, IList, IStack, IQueue { #region Fields @@ -554,7 +553,6 @@ public LinkedList() : this(EqualityComparer.Default) { } /// /// An individual cell in the linked list /// - [Serializable] private class Node { public Node? prev; @@ -589,7 +587,6 @@ public override string ToString() #endregion #region Position, PositionComparer and ViewHandler nested types - [Serializable] private class PositionComparer : SCG.IComparer { private static PositionComparer _default; @@ -753,7 +750,6 @@ internal void UpdateSentinels(int realindex, Node newstart, Node newend) #region Range nested class - [Serializable] private class Range : DirectedCollectionValueBase, IDirectedCollectionValue { // int start; @@ -831,7 +827,7 @@ public override IDirectedCollectionValue Backwards() IDirectedEnumerable IDirectedEnumerable.Backwards() { return Backwards(); } - public override EnumerationDirection Direction => forwards ? EnumerationDirection.Forwards : EnumerationDirection.Backwards; + public override Direction Direction => forwards ? Direction.Forwards : Direction.Backwards; } diff --git a/C5/Showing.cs b/C5/Showing.cs index d8a46ce2..45df0105 100644 --- a/C5/Showing.cs +++ b/C5/Showing.cs @@ -13,7 +13,6 @@ namespace C5 /// /// /// - [Serializable] public static class Showing { /// diff --git a/C5/Sorting/Sorting.cs b/C5/Sorting/Sorting.cs index 9ab225e8..0157cd4f 100644 --- a/C5/Sorting/Sorting.cs +++ b/C5/Sorting/Sorting.cs @@ -8,7 +8,6 @@ namespace C5 /// /// A utility class with functions for sorting arrays with respect to an IComparer<T> /// - [Serializable] public class Sorting { private Sorting() { } @@ -82,7 +81,7 @@ public static void HeapSort(T[] array, int start, int count, SCG.IComparer new Sorter(array, comparer).HeapSort(start, start + count); } - [Serializable] + private class Sorter { private readonly T[] a; diff --git a/C5/Trees/TreeBag.cs b/C5/Trees/TreeBag.cs index e95b895e..6a46a2cd 100644 --- a/C5/Trees/TreeBag.cs +++ b/C5/Trees/TreeBag.cs @@ -18,7 +18,6 @@ namespace C5 /// Each distinct item is only kept in one place in the tree - together with the number /// of times it is a member of the bag. Thus, if two items that are equal according /// - [Serializable] public class TreeBag : SequencedBase, IIndexedSorted, IPersistentSorted { #region Fields @@ -112,7 +111,6 @@ private void StackCheck() /// /// The type of node in a Red-Black binary tree /// - [Serializable] private class Node { public bool red = true; @@ -253,7 +251,6 @@ public TreeBag(SCG.IComparer comparer, SCG.IEqualityComparer equalityCompa /// of subtrees waiting to be enumerated. Currently only used for the tree set /// enumerators (tree bag enumerators use an iterator block based enumerator). /// - [Serializable] internal class Enumerator : SCG.IEnumerator { #region Private Fields @@ -405,7 +402,6 @@ void System.Collections.IEnumerator.Reset() /// An enumerator for a snapshot of a node copy persistent red-black tree /// collection. /// - [Serializable] internal class SnapEnumerator : SCG.IEnumerator { #region Private Fields @@ -2267,7 +2263,6 @@ public int ContainsCount(T item) //TODO: make work with snapshots - [Serializable] private class Multiplicities : CollectionValueBase>, ICollectionValue> { private readonly TreeBag treebag; @@ -2682,7 +2677,6 @@ public void RemoveInterval(int start, int count) } #region Interval nested class - [Serializable] private class Interval : DirectedCollectionValueBase, IDirectedCollectionValue { private readonly int start, length, stamp; @@ -2883,7 +2877,7 @@ IDirectedEnumerable C5.IDirectedEnumerable.Backwards() { return Backwards(); } - public override EnumerationDirection Direction => forwards ? EnumerationDirection.Forwards : EnumerationDirection.Backwards; + public override Direction Direction => forwards ? Direction.Forwards : Direction.Backwards; } #endregion @@ -3380,7 +3374,7 @@ public IDirectedCollectionValue RangeFrom(T bot) throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, true, bot, false, default, EnumerationDirection.Forwards); + return new Range(this, true, bot, false, default, Direction.Forwards); } @@ -3397,7 +3391,7 @@ public IDirectedCollectionValue RangeFromTo(T bot, T top) throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, true, bot, true, top, EnumerationDirection.Forwards); + return new Range(this, true, bot, true, top, Direction.Forwards); } @@ -3413,7 +3407,7 @@ public IDirectedCollectionValue RangeTo(T top) throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, false, default, true, top, EnumerationDirection.Forwards); + return new Range(this, false, default, true, top, Direction.Forwards); } @@ -3428,7 +3422,7 @@ public IDirectedCollectionValue RangeAll() throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, false, default, false, default, EnumerationDirection.Forwards); + return new Range(this, false, default, false, default, Direction.Forwards); } @@ -3805,7 +3799,6 @@ private int FindLastLiveSnapShot() return ((TreeBag)_snapshot!)!.generation; } - [Serializable] private class SnapRef { public SnapRef? Prev, Next; @@ -3932,7 +3925,6 @@ public ISorted Snapshot() #region TreeBag.Range nested class - [Serializable] internal class Range : DirectedCollectionValueBase, IDirectedCollectionValue { private int stamp; @@ -3942,10 +3934,10 @@ internal class Range : DirectedCollectionValueBase, IDirectedCollectionValue< private readonly T lowend, highend; private readonly bool haslowend, hashighend; - private EnumerationDirection direction; + private Direction direction; - public Range(TreeBag basis, bool haslowend, T lowend, bool hashighend, T highend, EnumerationDirection direction) + public Range(TreeBag basis, bool haslowend, T lowend, bool hashighend, T highend, Direction direction) { this.basis = basis; stamp = basis.stamp; @@ -3969,7 +3961,6 @@ public Range(TreeBag basis, bool haslowend, T lowend, bool hashighend, T high #region TreeBag.Range.Enumerator nested class - [Serializable] internal class Enumerator : SCG.IEnumerator { #region Private Fields @@ -3996,7 +3987,7 @@ public Enumerator(Range range) comparer = range.basis.comparer; path = new Node[2 * range.basis.blackdepth]; this.range = range; - forwards = range.direction == EnumerationDirection.Forwards; + forwards = range.direction == Direction.Forwards; cursor = new Node(); if (forwards) { @@ -4241,7 +4232,7 @@ public override T Choose() public override SCG.IEnumerator GetEnumerator() { return new Enumerator(this); } - public override EnumerationDirection Direction => direction; + public override Direction Direction => direction; #endregion @@ -4269,7 +4260,7 @@ public override IDirectedCollectionValue Backwards() { Range b = (Range)MemberwiseClone(); - b.direction = direction == EnumerationDirection.Forwards ? EnumerationDirection.Backwards : EnumerationDirection.Forwards; + b.direction = direction == Direction.Forwards ? Direction.Backwards : Direction.Forwards; return b; } diff --git a/C5/Trees/TreeDictionary.cs b/C5/Trees/TreeDictionary.cs index 0becc95f..0cd0a104 100644 --- a/C5/Trees/TreeDictionary.cs +++ b/C5/Trees/TreeDictionary.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A sorted generic dictionary based on a red-black tree set. /// - [Serializable] public class TreeDictionary : SortedDictionaryBase, IDictionary, ISortedDictionary { diff --git a/C5/Trees/TreeSet.cs b/C5/Trees/TreeSet.cs index 52398f3e..3313ac1e 100644 --- a/C5/Trees/TreeSet.cs +++ b/C5/Trees/TreeSet.cs @@ -20,7 +20,6 @@ namespace C5 /// TODO: discuss persistence and its useful usage modes. Warn about the space /// leak possible with other usage modes. /// - [Serializable] public class TreeSet : SequencedBase, IIndexedSorted, IPersistentSorted { #region Fields @@ -109,7 +108,6 @@ private void StackCheck() /// /// The type of node in a Red-Black binary tree /// - [Serializable] private class Node { public bool red = true; @@ -247,7 +245,6 @@ public TreeSet(SCG.IComparer comparer, SCG.IEqualityComparer equalityCompa /// of subtrees waiting to be enumerated. Currently only used for the tree set /// enumerators (tree bag enumerators use an iterator block based enumerator). /// - [Serializable] internal class Enumerator : SCG.IEnumerator { #region Private Fields @@ -399,7 +396,6 @@ void System.Collections.IEnumerator.Reset() /// An enumerator for a snapshot of a node copy persistent red-black tree /// collection. /// - [Serializable] internal class SnapEnumerator : SCG.IEnumerator { #region Private Fields @@ -2416,7 +2412,6 @@ public void RemoveInterval(int start, int count) } #region Interval nested class - [Serializable] private class Interval : DirectedCollectionValueBase, IDirectedCollectionValue { private readonly int start, length, stamp; @@ -2589,7 +2584,7 @@ IDirectedEnumerable C5.IDirectedEnumerable.Backwards() { return Backwards(); } - public override EnumerationDirection Direction => forwards ? EnumerationDirection.Forwards : EnumerationDirection.Backwards; + public override Direction Direction => forwards ? Direction.Forwards : Direction.Backwards; } #endregion @@ -3070,7 +3065,7 @@ public IDirectedCollectionValue RangeFrom(T bot) throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, true, bot, false, default, EnumerationDirection.Forwards); + return new Range(this, true, bot, false, default, Direction.Forwards); } @@ -3087,7 +3082,7 @@ public IDirectedCollectionValue RangeFromTo(T bot, T top) throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, true, bot, true, top, EnumerationDirection.Forwards); + return new Range(this, true, bot, true, top, Direction.Forwards); } @@ -3103,7 +3098,7 @@ public IDirectedCollectionValue RangeTo(T top) throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, false, default, true, top, EnumerationDirection.Forwards); + return new Range(this, false, default, true, top, Direction.Forwards); } @@ -3118,7 +3113,7 @@ public IDirectedCollectionValue RangeAll() throw new ViewDisposedException("Snapshot has been disposed"); } - return new Range(this, false, default, false, default, EnumerationDirection.Forwards); + return new Range(this, false, default, false, default, Direction.Forwards); } @@ -3494,7 +3489,6 @@ private int FindLastLiveSnapShot() return ((TreeSet)_snapshot!).generation; } - [Serializable] private class SnapRef { public SnapRef? Prev, Next; @@ -3598,7 +3592,6 @@ public ISorted Snapshot() #region TreeSet.Range nested class - [Serializable] internal class Range : DirectedCollectionValueBase, IDirectedCollectionValue { private int stamp; @@ -3608,10 +3601,10 @@ internal class Range : DirectedCollectionValueBase, IDirectedCollectionValue< private readonly T lowend, highend; private readonly bool haslowend, hashighend; - private EnumerationDirection direction; + private Direction direction; - public Range(TreeSet basis, bool haslowend, T lowend, bool hashighend, T highend, EnumerationDirection direction) + public Range(TreeSet basis, bool haslowend, T lowend, bool hashighend, T highend, Direction direction) { this.basis = basis; stamp = basis.stamp; @@ -3635,7 +3628,6 @@ public Range(TreeSet basis, bool haslowend, T lowend, bool hashighend, T high #region TreeSet.Range.Enumerator nested class - [Serializable] internal class Enumerator : SCG.IEnumerator { #region Private Fields @@ -3662,7 +3654,7 @@ public Enumerator(Range range) comparer = range.basis.comparer; path = new Node[2 * range.basis.blackdepth]; this.range = range; - forwards = range.direction == EnumerationDirection.Forwards; + forwards = range.direction == Direction.Forwards; cursor = new Node(); if (forwards) { @@ -3898,7 +3890,7 @@ public override T Choose() public override SCG.IEnumerator GetEnumerator() { return new Enumerator(this); } - public override EnumerationDirection Direction => direction; + public override Direction Direction => direction; #endregion @@ -3926,7 +3918,7 @@ public override IDirectedCollectionValue Backwards() { Range b = (Range)MemberwiseClone(); - b.direction = direction == EnumerationDirection.Forwards ? EnumerationDirection.Backwards : EnumerationDirection.Forwards; + b.direction = direction == Direction.Forwards ? Direction.Backwards : Direction.Forwards; return b; } diff --git a/C5/WeakViewList.cs b/C5/WeakViewList.cs index f4088ba0..50f86358 100644 --- a/C5/WeakViewList.cs +++ b/C5/WeakViewList.cs @@ -11,12 +11,10 @@ namespace C5 /// This class is shared between the linked list and array list implementations. /// /// - [Serializable] internal class WeakViewList where V : class { private Node? start; - [Serializable] internal class Node { internal WeakReference weakview; internal Node? prev; internal Node next; diff --git a/C5/WrappedArray.cs b/C5/WrappedArray.cs index 652da93c..4ad8464f 100644 --- a/C5/WrappedArray.cs +++ b/C5/WrappedArray.cs @@ -12,10 +12,8 @@ namespace C5 /// size of the array will be invalid (and throw /// /// - [Serializable] public class WrappedArray : IList, SCG.IList { - [Serializable] private class InnerList : ArrayList { internal InnerList(T[] array) { this.array = array; size = array.Length; } @@ -788,7 +786,7 @@ public bool Show(StringBuilder stringbuilder, ref int rest, IFormatProvider? for /// /// /// - public EnumerationDirection Direction => EnumerationDirection.Forwards; + public Direction Direction => Direction.Forwards; #endregion diff --git a/C5/Wrappers/GuardedCollection.cs b/C5/Wrappers/GuardedCollection.cs index 947769ba..badfa9fe 100644 --- a/C5/Wrappers/GuardedCollection.cs +++ b/C5/Wrappers/GuardedCollection.cs @@ -8,7 +8,6 @@ namespace C5 /// Suitable for wrapping hash tables, /// and /// - [Serializable] public class GuardedCollection : GuardedCollectionValue, ICollection { #region Fields diff --git a/C5/Wrappers/GuardedCollectionValue.cs b/C5/Wrappers/GuardedCollectionValue.cs index 4470732e..75ef21d1 100644 --- a/C5/Wrappers/GuardedCollectionValue.cs +++ b/C5/Wrappers/GuardedCollectionValue.cs @@ -7,7 +7,6 @@ namespace C5 /// /// This is mainly interesting as a base of other guard classes /// - [Serializable] public class GuardedCollectionValue : GuardedEnumerable, ICollectionValue { #region Events diff --git a/C5/Wrappers/GuardedDictionary.cs b/C5/Wrappers/GuardedDictionary.cs index 248325d0..469fa931 100644 --- a/C5/Wrappers/GuardedDictionary.cs +++ b/C5/Wrappers/GuardedDictionary.cs @@ -8,7 +8,6 @@ namespace C5 /// /// Suitable for wrapping a HashDictionary. /// - [Serializable] public class GuardedDictionary : GuardedCollectionValue>, IDictionary { #region Fields diff --git a/C5/Wrappers/GuardedDirectedCollectionValue.cs b/C5/Wrappers/GuardedDirectedCollectionValue.cs index 759d15d3..fdf15287 100644 --- a/C5/Wrappers/GuardedDirectedCollectionValue.cs +++ b/C5/Wrappers/GuardedDirectedCollectionValue.cs @@ -7,7 +7,6 @@ namespace C5 /// /// This is mainly interesting as a base of other guard classes /// - [Serializable] public class GuardedDirectedCollectionValue : GuardedCollectionValue, IDirectedCollectionValue { #region Fields @@ -58,7 +57,7 @@ IDirectedEnumerable IDirectedEnumerable.Backwards() /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - public EnumerationDirection Direction => directedcollection.Direction; + public Direction Direction => directedcollection.Direction; #endregion } diff --git a/C5/Wrappers/GuardedDirectedEnumerable.cs b/C5/Wrappers/GuardedDirectedEnumerable.cs index 9e1022a4..19f84f96 100644 --- a/C5/Wrappers/GuardedDirectedEnumerable.cs +++ b/C5/Wrappers/GuardedDirectedEnumerable.cs @@ -7,7 +7,6 @@ namespace C5 /// /// This is mainly interesting as a base of other guard classes /// - [Serializable] public class GuardedDirectedEnumerable : GuardedEnumerable, IDirectedEnumerable { #region Fields @@ -42,7 +41,7 @@ public IDirectedEnumerable Backwards() /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - public EnumerationDirection Direction => directedenumerable.Direction; + public Direction Direction => directedenumerable.Direction; #endregion } diff --git a/C5/Wrappers/GuardedEnumerable.cs b/C5/Wrappers/GuardedEnumerable.cs index 99b6b527..6f3e7f28 100644 --- a/C5/Wrappers/GuardedEnumerable.cs +++ b/C5/Wrappers/GuardedEnumerable.cs @@ -8,7 +8,6 @@ namespace C5 /// /// This is mainly interesting as a base of other guard classes /// - [Serializable] public class GuardedEnumerable : System.Collections.Generic.IEnumerable { #region Fields diff --git a/C5/Wrappers/GuardedEnumerator.cs b/C5/Wrappers/GuardedEnumerator.cs index c3bff9c4..4b9dc3b4 100644 --- a/C5/Wrappers/GuardedEnumerator.cs +++ b/C5/Wrappers/GuardedEnumerator.cs @@ -9,7 +9,6 @@ namespace C5 /// /// A read-only wrapper class for a generic enumerator /// - [Serializable] public class GuardedEnumerator : IEnumerator { #region Fields diff --git a/C5/Wrappers/GuardedIndexedSorted.cs b/C5/Wrappers/GuardedIndexedSorted.cs index e6d3218d..8617761a 100644 --- a/C5/Wrappers/GuardedIndexedSorted.cs +++ b/C5/Wrappers/GuardedIndexedSorted.cs @@ -7,7 +7,6 @@ namespace C5 /// /// Suitable for wrapping TreeSet, TreeBag and SortedArray /// - [Serializable] public class GuardedIndexedSorted : GuardedSorted, IIndexedSorted { #region Fields diff --git a/C5/Wrappers/GuardedList.cs b/C5/Wrappers/GuardedList.cs index a48d4cdf..f62d4270 100644 --- a/C5/Wrappers/GuardedList.cs +++ b/C5/Wrappers/GuardedList.cs @@ -11,7 +11,6 @@ namespace C5 /// . /// /// - [Serializable] public class GuardedList : GuardedSequenced, IList, System.Collections.Generic.IList { #region Fields diff --git a/C5/Wrappers/GuardedQueue.cs b/C5/Wrappers/GuardedQueue.cs index 06df15ff..5680d814 100644 --- a/C5/Wrappers/GuardedQueue.cs +++ b/C5/Wrappers/GuardedQueue.cs @@ -8,7 +8,6 @@ namespace C5 /// Suitable for wrapping a /// /// The item type. - [Serializable] public class GuardedQueue : GuardedDirectedCollectionValue, IQueue { #region Fields diff --git a/C5/Wrappers/GuardedSequenced.cs b/C5/Wrappers/GuardedSequenced.cs index 35486556..9b3623df 100644 --- a/C5/Wrappers/GuardedSequenced.cs +++ b/C5/Wrappers/GuardedSequenced.cs @@ -7,7 +7,6 @@ namespace C5 /// /// This is mainly interesting as a base of other guard classes /// - [Serializable] public class GuardedSequenced : GuardedCollection, ISequenced { #region Fields @@ -131,7 +130,7 @@ IDirectedEnumerable IDirectedEnumerable.Backwards() /// Forwards if same, else Backwards /// /// The enumeration direction relative to the original collection. - public EnumerationDirection Direction => EnumerationDirection.Forwards; + public Direction Direction => Direction.Forwards; #endregion } diff --git a/C5/Wrappers/GuardedSorted.cs b/C5/Wrappers/GuardedSorted.cs index 3f33cabb..3a0a003d 100644 --- a/C5/Wrappers/GuardedSorted.cs +++ b/C5/Wrappers/GuardedSorted.cs @@ -7,7 +7,6 @@ namespace C5 /// /// This is mainly interesting as a base of other guard classes /// - [Serializable] public class GuardedSorted : GuardedSequenced, ISorted { #region Fields diff --git a/C5/Wrappers/GuardedSortedDictionary.cs b/C5/Wrappers/GuardedSortedDictionary.cs index 4743aeca..5269d3b5 100644 --- a/C5/Wrappers/GuardedSortedDictionary.cs +++ b/C5/Wrappers/GuardedSortedDictionary.cs @@ -8,7 +8,6 @@ namespace C5 /// /// Suitable for wrapping a Dictionary. /// - [Serializable] public class GuardedSortedDictionary : GuardedDictionary, ISortedDictionary { #region Fields diff --git a/Doxyfile b/Doxyfile deleted file mode 100644 index 14401e5f..00000000 --- a/Doxyfile +++ /dev/null @@ -1,385 +0,0 @@ -# Doxyfile 1.8.17 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = C5 -PROJECT_NUMBER = 3.0 -PROJECT_BRIEF = "The C5 library is a set of generic collection classes (or container classes) for the C# programming language and other generics-enabled languages on later versions the CLI platform, as implemented by Microsoft .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5.0, and Mono." -PROJECT_LOGO = "images/logo-blue.png" -OUTPUT_DIRECTORY = docs -CREATE_SUBDIRS = YES -ALLOW_UNICODE_NAMES = NO -OUTPUT_LANGUAGE = English -OUTPUT_TEXT_DIRECTION = None -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -JAVADOC_BANNER = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -OPTIMIZE_OUTPUT_SLICE = NO -EXTENSION_MAPPING = -MARKDOWN_SUPPORT = YES -TOC_INCLUDE_HEADINGS = 5 -AUTOLINK_SUPPORT = YES -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -GROUP_NESTED_COMPOUNDS = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_PRIV_VIRTUAL = NO -EXTRACT_PACKAGE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -HIDE_COMPOUND_REFERENCE= NO -SHOW_INCLUDE_FILES = YES -SHOW_GROUPED_MEMB_INC = NO -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_AS_ERROR = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = C5 -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.idl \ - *.ddl \ - *.odl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.cs \ - *.d \ - *.php \ - *.php4 \ - *.php5 \ - *.phtml \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.doc \ - *.txt \ - *.py \ - *.pyw \ - *.f90 \ - *.f95 \ - *.f03 \ - *.f08 \ - *.f \ - *.for \ - *.tcl \ - *.vhd \ - *.vhdl \ - *.ucf \ - *.qsf \ - *.ice -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -USE_MDFILE_AS_MAINPAGE = -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = YES -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -SOURCE_TOOLTIPS = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -CLANG_ASSISTED_PARSING = NO -CLANG_OPTIONS = -CLANG_DATABASE_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = NO -HTML_DYNAMIC_MENUS = YES -HTML_DYNAMIC_SECTIONS = NO -HTML_INDEX_NUM_ENTRIES = 100 -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -FORMULA_MACROFILE = -USE_MATHJAX = NO -MATHJAX_FORMAT = HTML-CSS -MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ -MATHJAX_EXTENSIONS = -MATHJAX_CODEFILE = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -EXTERNAL_SEARCH = NO -SEARCHENGINE_URL = -SEARCHDATA_FILE = searchdata.xml -EXTERNAL_SEARCH_ID = -EXTRA_SEARCH_MAPPINGS = -#--------------------------------------------------------------------------- -# Configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = -MAKEINDEX_CMD_NAME = makeindex -LATEX_MAKEINDEX_CMD = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -LATEX_EXTRA_STYLESHEET = -LATEX_EXTRA_FILES = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -LATEX_TIMESTAMP = NO -LATEX_EMOJI_DIRECTORY = -#--------------------------------------------------------------------------- -# Configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -RTF_SOURCE_CODE = NO -#--------------------------------------------------------------------------- -# Configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_SUBDIR = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# Configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_PROGRAMLISTING = YES -XML_NS_MEMB_FILE_SCOPE = NO -#--------------------------------------------------------------------------- -# Configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- -GENERATE_DOCBOOK = NO -DOCBOOK_OUTPUT = docbook -DOCBOOK_PROGRAMLISTING = NO -#--------------------------------------------------------------------------- -# Configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -EXTERNAL_PAGES = YES -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -DIA_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -UML_LIMIT_NUM_FIELDS = 10 -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DIAFILE_DIRS = -PLANTUML_JAR_PATH = -PLANTUML_CFG_FILE = -PLANTUML_INCLUDE_PATH = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/README.md b/README.md index ff4c5b5c..552eef5d 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,13 @@ [![NuGet version (C5)](https://img.shields.io/nuget/v/C5.svg)](https://www.nuget.org/packages/C5/) [![.github/workflows/main.yml](https://github.com/sestoft/C5/actions/workflows/main.yml/badge.svg)](https://github.com/sestoft/C5/actions/workflows/main.yml) -The C5 library is a set of generic collection classes (or container classes) for the C# programming language and other generics-enabled languages on later versions the CLI platform, as implemented by Microsoft .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5.0+, and Mono. +The C5 library is a set of generic collection classes (or container classes) for the C# programming language and other generics-enabled languages on later versions of the .NET runtime (Common Language Runtime). The C5 library provides a wide range of classic data structures, rich functionality, the best possible asymptotic time complexity, documented performance, and a thoroughly tested implementation. ## Goals of the C5 library -The overall goal is for C5 to be a generic collection library for the C# programming language and the Common Language Infrastructure (CLI) whose functionality, efficiency and quality meets or exeeds what is available for similar contemporary programming platforms. +The overall goal is for C5 to be a generic collection library for the C# programming language and the Common Language Infrastructure (CLI) whose functionality, efficiency and quality meets or exceeds what is available for similar contemporary programming platforms. The design has been influenced by the collection libraries for Java and SmallTalk and the published critique of these. @@ -19,8 +19,6 @@ However, it contains functionality and a regularity of design that considerably Research notes are available here: . -Auto-generated documentation can be found here: . - ## Why yet another generic collection library There are already other generic collection libraries for C#/CLI, including the `System.Collections.Generic` namespace introduced with .NET 2.0 and Wintellect's Power Collections for .NET by Peter Golde (). @@ -53,15 +51,15 @@ Most of the library API documentation is in place but requires proof-reading. The C5 implementation was originally built on .NET 2.0 and has only recently been upgraded to .NET 4.0. It does not (yet) use a great number of the new features introduced with C# 3 and 4, notably LINQ and covariant and contravariant type parameters. -C5 is a .NET Standard 2.0 library supporting .NET Core 2.0+, .NET 4.6.1+, Universal Windows Platform, Mono, and Xamarin. +C5 targets .NET Standard 2.0, NET 6.0, and .NET 8.0. ## Getting Started 1. Get C5 from [NuGet](https://www.nuget.org/packages/C5): -```bash -$ dotnet add package C5 -``` + ```bash + dotnet add package C5 + ``` 1. Building the unit test project requires NUnit. If you have NuGet installed it should automatically add the reference. diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 8d1b52e1..6728a6f3 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,15 +1,23 @@ # Release Notes for C5 Generic Collection Library for C#/CLI +## Release 3.0.0 of 2024-06-06 + +- C5 now targets .NET Standard 2.0, .NET 6.0 and .NET 8.0. +- Breaking change: `Rec` type removed as it was an exact copy of `ValueTuple`. +- Breaking change: All `public readonly` are now properties. +- Breaking change: `EventTypeEnum` is now `EventType`. +- Breaking change: custom `KeyValuePair` has been replaced by the standard `System.Collections.Generic.KeyValue` for better compatibility. +- Breaking change: `EnumerationDirection` is now `Direction`. +- `[Serializable]` attribute removed. Cf. [BinaryFormatter security guide](https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide). + ## Release 3.0.0-rc of 2021-12-22 - C5 now targets .NET Standard 2.0 and .NET 6.0. -- Documentation is autogenerated on build and published to . - Strong name removed. - Memory safe optimizer removed as they are no longer needed for Unity development. -- `Rec` type removed as was an exact copy of `ValueTuple`. - Breaking change: All `public readonly` are now properties. - Breaking change: `EventTypeEnum` is now `EventType`. -- Breaking change: custom `KeyValuePair` has been replaced by the standard `System.Collections.Generic.KeyValue` for better compatability. +- Breaking change: custom `KeyValuePair` has been replaced by the standard `System.Collections.Generic.KeyValue` for better compatibility. - Deprecation warning: As per [BinaryFormatter security guide](https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide), binary deserialization present high security risk. For this reason the `[Serializable]` attribute will be removed from the entire library in the next release. ## Release 2.5 of 2017-07-07 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 451f0945..ab9fe75f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,40 +1,6 @@ -# Build ASP.NET Core project using Azure Pipelines -# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core?view=vsts - +--- pool: - vmImage: 'windows-latest' - -variables: - buildConfiguration: 'Release' + vmImage: ubuntu-latest steps: -- task: UseDotNet@2 - inputs: - version: '6.0.x' - packageType: sdk - -- task: DotNetCoreCLI@2 - displayName: Build - inputs: - command: build - arguments: /P:SourceLinkCreate=false --configuration $(buildConfiguration) - -- task: DotNetCoreCLI@2 - displayName: Test - inputs: - command: test - projects: "**/*Tests/*.csproj" - arguments: '/P:SourceLinkCreate=false --configuration $(buildConfiguration) --collect "Code coverage"' - -- task: CopyFiles@2 - displayName: 'Copy files' - inputs: - sourceFolder: $(Build.SourcesDirectory)/C5/bin/$(buildConfiguration) - contents: '*.nupkg' - targetFolder: $(Build.ArtifactStagingDirectory) - flattenFolders: true - -- task: PublishPipelineArtifact@1 - inputs: - targetPath: $(Build.ArtifactStagingDirectory) - artifactName: drop \ No newline at end of file + - script: echo "Migrated to GitHub Actions"