Browse Source

Fixed compilation error for older frameworks

pull/2088/head
Dmitry Pentin 4 years ago
parent
commit
210945f939
  1. 16
      src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs

16
src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs

@ -79,8 +79,20 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
return CharacterCodeBytesLength + count;
}
public static unsafe int Write(Encoding encoding, string value, Span<byte> destination) =>
encoding.GetBytes(value.AsSpan(), destination);
public static unsafe int Write(Encoding encoding, string value, Span<byte> destination)
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER || NET
=> encoding.GetBytes(value.AsSpan(), destination);
#else
{
fixed (char* c = value)
{
fixed (byte* b = destination)
{
return encoding.GetBytes(c, value.Length, b, destination.Length);
}
}
}
#endif
private static bool TryDetect(ReadOnlySpan<byte> buffer, out CharacterCode code)
{

Loading…
Cancel
Save