Skip to content

Commit

Permalink
use IsReferenceOrContainsReferences for .NET Standard 2.1+ and 6_0+ (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornhoof authored Mar 24, 2024
1 parent 1111326 commit 281bdff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cs/src/core/Utilities/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ internal static string PrettySize(long value)
/// <returns></returns>
internal static bool IsBlittable<T>()
{
#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER
return !RuntimeHelpers.IsReferenceOrContainsReferences<T>();
#else

if (default(T) == null)
return false;

Expand All @@ -156,6 +160,7 @@ internal static bool IsBlittable<T>()
return false;
}
return true;
#endif
}

/// <summary>
Expand Down

0 comments on commit 281bdff

Please sign in to comment.