Browse Source

Improved Guard.MustBeValueType<T> codegen

Can now be JITted to a constant on .NET 5, see https://github.com/dotnet/runtime/pull/1157
js/color-alpha-handling
Sergio Pedri 6 years ago
parent
commit
34522eb62c
  1. 8
      src/ImageSharp/Common/Helpers/Guard.cs

8
src/ImageSharp/Common/Helpers/Guard.cs

@ -2,7 +2,9 @@
// Licensed under the Apache License, Version 2.0.
using System;
#if NETSTANDARD1_3
using System.Reflection;
#endif
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp;
@ -20,7 +22,11 @@ namespace SixLabors
[MethodImpl(InliningOptions.ShortMethod)]
public static void MustBeValueType<TValue>(TValue value, string parameterName)
{
if (value.GetType().GetTypeInfo().IsValueType)
if (value.GetType()
#if NETSTANDARD1_3
.GetTypeInfo()
#endif
.IsValueType)
{
return;
}

Loading…
Cancel
Save