summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-04-11 14:47:22 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-04-11 14:47:22 +0700
commitf39c54f71e8e9f053b7efb6e69b1429944badba4 (patch)
treebe1ec649d4f6568627fdb19b04453db977967c3f
parentReduce internal usage of ISet<T> (diff)
downloadBouncyCastle.NET-ed25519-f39c54f71e8e9f053b7efb6e69b1429944badba4.tar.xz
Platform guards for ReadOnlySet<T>
-rw-r--r--crypto/src/util/collections/CollectionUtilities.cs2
-rw-r--r--crypto/src/util/collections/ReadOnlySet.cs7
2 files changed, 9 insertions, 0 deletions
diff --git a/crypto/src/util/collections/CollectionUtilities.cs b/crypto/src/util/collections/CollectionUtilities.cs
index a1fb0e949..6f94c4409 100644
--- a/crypto/src/util/collections/CollectionUtilities.cs
+++ b/crypto/src/util/collections/CollectionUtilities.cs
@@ -75,10 +75,12 @@ namespace Org.BouncyCastle.Utilities.Collections
             return new ReadOnlyListProxy<T>(l);
         }
 
+#if NETCOREAPP1_0_OR_GREATER || NET40_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         public static ISet<T> ReadOnly<T>(ISet<T> s)
         {
             return new ReadOnlySetProxy<T>(s);
         }
+#endif
 
         public static bool Remove<K, V>(IDictionary<K, V> d, K k, out V v)
         {
diff --git a/crypto/src/util/collections/ReadOnlySet.cs b/crypto/src/util/collections/ReadOnlySet.cs
index 36c198f07..d77494847 100644
--- a/crypto/src/util/collections/ReadOnlySet.cs
+++ b/crypto/src/util/collections/ReadOnlySet.cs
@@ -1,10 +1,15 @@
 using System;
+using System.Collections;
 using System.Collections.Generic;
 
 namespace Org.BouncyCastle.Utilities.Collections
 {
     internal abstract class ReadOnlySet<T>
+#if NETCOREAPP1_0_OR_GREATER || NET40_OR_GREATER || NETSTANDARD1_0_OR_GREATER
         : ISet<T>
+#else
+        : ICollection<T>, IEnumerable<T>, IEnumerable
+#endif
     {
         System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
         {
@@ -35,6 +40,7 @@ namespace Org.BouncyCastle.Utilities.Collections
         public abstract bool Overlaps(IEnumerable<T> other);
     }
 
+#if NETCOREAPP1_0_OR_GREATER || NET40_OR_GREATER || NETSTANDARD1_0_OR_GREATER
     internal class ReadOnlySetProxy<T>
         : ReadOnlySet<T>
     {
@@ -58,4 +64,5 @@ namespace Org.BouncyCastle.Utilities.Collections
         public override bool IsSupersetOf(IEnumerable<T> other) => m_target.IsSupersetOf(other);
         public override bool Overlaps(IEnumerable<T> other) => m_target.Overlaps(other);
     }
+#endif
 }