From 281bdff595924464935ed0d8eef76d4166ca3d03 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 24 Mar 2024 22:12:53 +0100 Subject: [PATCH] use IsReferenceOrContainsReferences for .NET Standard 2.1+ and 6_0+ (#901) --- cs/src/core/Utilities/Utility.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cs/src/core/Utilities/Utility.cs b/cs/src/core/Utilities/Utility.cs index 2d2986a24..a1d74edfc 100644 --- a/cs/src/core/Utilities/Utility.cs +++ b/cs/src/core/Utilities/Utility.cs @@ -142,6 +142,10 @@ internal static string PrettySize(long value) /// internal static bool IsBlittable() { +#if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER + return !RuntimeHelpers.IsReferenceOrContainsReferences(); +#else + if (default(T) == null) return false; @@ -156,6 +160,7 @@ internal static bool IsBlittable() return false; } return true; +#endif } ///