From 856423944e3a66b9c939c751c738c4d2c0fd39b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rasmus=20Lystr=C3=B8m?= Date: Wed, 16 Dec 2015 14:58:48 +0100 Subject: [PATCH] KeyValuePair.Create --- C5.Tests/C5.Tests.csproj | 1 + C5.Tests/KeyValuePairTests.cs | 17 +++++++++++++++++ C5/Dictionaries.cs | 24 ++++++++++++++---------- RELEASE-NOTES.txt | 7 +++++++ 4 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 C5.Tests/KeyValuePairTests.cs diff --git a/C5.Tests/C5.Tests.csproj b/C5.Tests/C5.Tests.csproj index 2218671b..1a62ff6a 100644 --- a/C5.Tests/C5.Tests.csproj +++ b/C5.Tests/C5.Tests.csproj @@ -54,6 +54,7 @@ Code + diff --git a/C5.Tests/KeyValuePairTests.cs b/C5.Tests/KeyValuePairTests.cs new file mode 100644 index 00000000..c4f36ad3 --- /dev/null +++ b/C5.Tests/KeyValuePairTests.cs @@ -0,0 +1,17 @@ +using NUnit.Framework; + +namespace C5.Tests +{ + [TestFixture] + public class KeyValuePairTests + { + [Test] + public void Create() + { + var p1 = new KeyValuePair(42, "The answer"); + var p2 = KeyValuePair.Create(42, "The answer"); + + Assert.AreEqual(p1, p2); + } + } +} diff --git a/C5/Dictionaries.cs b/C5/Dictionaries.cs index a58d435a..f0407085 100644 --- a/C5/Dictionaries.cs +++ b/C5/Dictionaries.cs @@ -74,16 +74,6 @@ public override bool Equals(object obj) return Equals(other); } - - /// - /// Create an instance of the KeyValuePair using type inference. - /// - public static KeyValuePair Create(K key, V value) - { - return new KeyValuePair(key, value); - } - - /// /// Get the hash code of the pair. /// @@ -1262,6 +1252,20 @@ public override bool Show(System.Text.StringBuilder stringbuilder, ref int rest, } + /// + /// Static class to allow creation of KeyValuePair using type inference + /// + public static class KeyValuePair + { + /// + /// Create an instance of the KeyValuePair using type inference. + /// + public static KeyValuePair Create(K key, V value) + { + return new KeyValuePair(key, value); + } + } + [Serializable] class SortedArrayDictionary : SortedDictionaryBase { diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 85c2eb1d..f212d1f9 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,13 @@ RELEASE NOTES FOR C5 GENERIC COLLECTION LIBRARY FOR C#/CLI ------------------------------ +Release 2.4.5828 of 2015-12-15 + + * KeyValuePair Serializable + * KeyValuePair.Create using type inference. + * Added .NET 4.5 version: IIndexed implements IReadOnlyList. + * Fixed typos. + Release 2.4 of 2015-12-15 * Support for Universal Windows Platform