From 2a4857ac3d424893ee420c6d20b9a29fff96e0db Mon Sep 17 00:00:00 2001
From: platofff <42435266+platofff@users.noreply.github.com>
Date: Thu, 24 Oct 2024 11:53:10 +0300
Subject: [PATCH] Implement IReadOnlyDictionary and IReadOnlyList
---
Value/DictionaryByValue.cs | 6 +++++-
Value/ListByValue.cs | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Value/DictionaryByValue.cs b/Value/DictionaryByValue.cs
index 2b6b1ea..186ce7e 100644
--- a/Value/DictionaryByValue.cs
+++ b/Value/DictionaryByValue.cs
@@ -27,7 +27,7 @@ namespace Value.Shared
/// This type is not thread-safe (for hashcode updates).
/// The type of keys in the dictionary.
/// The type of values in the dictionary.
- public class DictionaryByValue : EquatableByValueWithoutOrder>, IDictionary
+ public class DictionaryByValue : EquatableByValueWithoutOrder>, IDictionary, IReadOnlyDictionary
{
private readonly IDictionary dictionary;
@@ -132,5 +132,9 @@ public V this[K key]
public ICollection Keys => dictionary.Keys;
public ICollection Values => dictionary.Values;
+
+ IEnumerable IReadOnlyDictionary.Keys => dictionary.Keys;
+
+ IEnumerable IReadOnlyDictionary.Values => dictionary.Values;
}
}
\ No newline at end of file
diff --git a/Value/ListByValue.cs b/Value/ListByValue.cs
index 296016a..b0b9fba 100644
--- a/Value/ListByValue.cs
+++ b/Value/ListByValue.cs
@@ -27,7 +27,7 @@ namespace Value
///
/// This type is not thread-safe (for hashcode updates).
/// Type of the listed items.
- public class ListByValue : EquatableByValue>, IList
+ public class ListByValue : EquatableByValue>, IList, IReadOnlyList
{
private readonly IList list;