Created
September 20, 2022 06:29
-
-
Save mgravell/b861a5d92afc113d3b3e7276fdb98932 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override bool TryGetArray(out ArraySegment<T> segment) | |
{ | |
if (typeof(T) == typeof(byte)) | |
{ | |
return MemoryMarshal.TryGetArray(Unsafe.As<Memory<byte>, Memory<T>>(ref Unsafe.AsRef(in this.memory)), out segment); | |
} | |
else | |
{ | |
segment = default; | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment