THRIFT-5349 Add net5.0 as supported platform
Client: netstd
Patch: Jens Geyer
This closes #2328
diff --git a/lib/netstd/Thrift/Collections/TCollections.cs b/lib/netstd/Thrift/Collections/TCollections.cs
index b386c37..21ee3bb 100644
--- a/lib/netstd/Thrift/Collections/TCollections.cs
+++ b/lib/netstd/Thrift/Collections/TCollections.cs
@@ -99,8 +99,7 @@
foreach (var obj in enumerable)
{
- var enum2 = obj as IEnumerable;
- var objHash = enum2 == null ? obj.GetHashCode() : GetHashCode(enum2);
+ var objHash = (obj is IEnumerable enum2) ? GetHashCode(enum2) : obj.GetHashCode();
unchecked
{
diff --git a/lib/netstd/Thrift/Collections/THashSet.cs b/lib/netstd/Thrift/Collections/THashSet.cs
index 8dfb9e3..25fcf10 100644
--- a/lib/netstd/Thrift/Collections/THashSet.cs
+++ b/lib/netstd/Thrift/Collections/THashSet.cs
@@ -32,8 +32,13 @@
public THashSet(int capacity)
{
- // TODO: uncomment capacity when NET Standard also implements it
- Items = new HashSet<T>(/*capacity*/);
+ #if NET5_0
+ Items = new HashSet<T>(capacity);
+ #elif NETFRAMEWORK || NETSTANDARD
+ Items = new HashSet<T>(/*capacity not supported*/);
+ #else
+ #error Unknown platform
+ #endif
}
public int Count => Items.Count;