Skip to content

Commit d152928

Browse files
committed
IsByRefLike Conditional compilation.
1 parent 2cfe68f commit d152928

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ private static bool IsRunnableGenericType(TypeInfo typeInfo)
235235
internal static bool IsLinqPad(this Assembly assembly) => assembly.FullName.IndexOf("LINQPAD", StringComparison.OrdinalIgnoreCase) >= 0;
236236

237237
internal static bool IsByRefLike(this Type type)
238+
#if NETSTANDARD2_0
238239
// Type.IsByRefLike is not available in netstandard2.0.
239240
=> type.IsValueType && type.CustomAttributes.Any(attr => attr.AttributeType.FullName == "System.Runtime.CompilerServices.IsByRefLikeAttribute");
241+
#else
242+
=> type.IsByRefLike;
243+
#endif
240244
}
241245
}

0 commit comments

Comments
 (0)