From ed9afa880165ac1176f9eb8b2ab3276215ba6b8e Mon Sep 17 00:00:00 2001 From: Eirik Tsarpalis Date: Thu, 29 Sep 2022 17:05:52 +0300 Subject: [PATCH] Make KeysCollection.Contains methods public. (#76319) --- src/libraries/System.Collections/ref/System.Collections.cs | 4 ++-- .../src/System/Collections/Generic/SortedDictionary.cs | 2 +- .../src/System/Collections/Generic/Dictionary.cs | 2 +- .../src/System/Collections/ObjectModel/ReadOnlyDictionary.cs | 2 +- src/libraries/System.Runtime/ref/System.Runtime.cs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.Collections/ref/System.Collections.cs b/src/libraries/System.Collections/ref/System.Collections.cs index d841eddec8bf0..56040f1820476 100644 --- a/src/libraries/System.Collections/ref/System.Collections.cs +++ b/src/libraries/System.Collections/ref/System.Collections.cs @@ -209,7 +209,7 @@ public void CopyTo(TKey[] array, int index) { } public System.Collections.Generic.SortedDictionary.KeyCollection.Enumerator GetEnumerator() { throw null; } void System.Collections.Generic.ICollection.Add(TKey item) { } void System.Collections.Generic.ICollection.Clear() { } - bool System.Collections.Generic.ICollection.Contains(TKey item) { throw null; } + public bool Contains(TKey item) { throw null; } bool System.Collections.Generic.ICollection.Remove(TKey item) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } void System.Collections.ICollection.CopyTo(System.Array array, int index) { } @@ -500,7 +500,7 @@ public void CopyTo(TKey[] array, int index) { } public System.Collections.Generic.Dictionary.KeyCollection.Enumerator GetEnumerator() { throw null; } void System.Collections.Generic.ICollection.Add(TKey item) { } void System.Collections.Generic.ICollection.Clear() { } - bool System.Collections.Generic.ICollection.Contains(TKey item) { throw null; } + public bool Contains(TKey item) { throw null; } bool System.Collections.Generic.ICollection.Remove(TKey item) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } void System.Collections.ICollection.CopyTo(System.Array array, int index) { } diff --git a/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs b/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs index 8925d080f8515..ab700e3a88e8a 100644 --- a/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs +++ b/src/libraries/System.Collections/src/System/Collections/Generic/SortedDictionary.cs @@ -637,7 +637,7 @@ void ICollection.Clear() throw new NotSupportedException(SR.NotSupported_KeyCollectionSet); } - bool ICollection.Contains(TKey item) + public bool Contains(TKey item) { return _dictionary.ContainsKey(item); } diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs index 88e63dde0aa11..870acdfbee6c6 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs @@ -1504,7 +1504,7 @@ void ICollection.Add(TKey item) => void ICollection.Clear() => ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_KeyCollectionSet); - bool ICollection.Contains(TKey item) => + public bool Contains(TKey item) => _dictionary.ContainsKey(item); bool ICollection.Remove(TKey item) diff --git a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs index b3eff597377c1..a13af07cd8674 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs @@ -264,7 +264,7 @@ void ICollection.Clear() throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); } - bool ICollection.Contains(TKey item) + public bool Contains(TKey item) { return _collection.Contains(item); } diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 3137a78af5109..8ec969852d1c8 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -7608,7 +7608,7 @@ public void CopyTo(TKey[] array, int arrayIndex) { } public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } void System.Collections.Generic.ICollection.Add(TKey item) { } void System.Collections.Generic.ICollection.Clear() { } - bool System.Collections.Generic.ICollection.Contains(TKey item) { throw null; } + public bool Contains(TKey item) { throw null; } bool System.Collections.Generic.ICollection.Remove(TKey item) { throw null; } void System.Collections.ICollection.CopyTo(System.Array array, int index) { } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }