Skip to content

Commit 281bdff

Browse files
authored
use IsReferenceOrContainsReferences for .NET Standard 2.1+ and 6_0+ (#901)
1 parent 1111326 commit 281bdff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cs/src/core/Utilities/Utility.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ internal static string PrettySize(long value)
142142
/// <returns></returns>
143143
internal static bool IsBlittable<T>()
144144
{
145+
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
146+
return !RuntimeHelpers.IsReferenceOrContainsReferences<T>();
147+
#else
148+
145149
if (default(T) == null)
146150
return false;
147151

@@ -156,6 +160,7 @@ internal static bool IsBlittable<T>()
156160
return false;
157161
}
158162
return true;
163+
#endif
159164
}
160165

161166
/// <summary>

0 commit comments

Comments
 (0)