From 727c0dc1fae6c7b72f59fb29f47a52f133618461 Mon Sep 17 00:00:00 2001 From: Jean-Rémy Bancel Date: Wed, 12 Jul 2017 00:25:30 -0700 Subject: C#: Implement IReadOnlyDictionary in MapField --- csharp/src/Google.Protobuf/Collections/MapField.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'csharp/src/Google.Protobuf') diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs index ef5651c9..8dac8e30 100644 --- a/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -67,6 +67,9 @@ namespace Google.Protobuf.Collections /// /// public sealed class MapField : IDeepCloneable>, IDictionary, IEquatable>, IDictionary +#if !NET35 + , IReadOnlyDictionary +#endif { // TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.) private readonly Dictionary>> map = @@ -548,6 +551,14 @@ namespace Google.Protobuf.Collections } #endregion + #region IReadOnlyDictionary explicit interface implementation +#if !NET35 + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; +#endif + #endregion + private class DictionaryEnumerator : IDictionaryEnumerator { private readonly IEnumerator> enumerator; -- cgit v1.2.3