# System.Runtime.InteropServices ``` diff namespace System.Runtime.InteropServices { + public static class MemoryMarshal { + public static ReadOnlySpan AsBytes(ReadOnlySpan span) where T : struct; + public static Span AsBytes(Span span) where T : struct; + public static Memory AsMemory(ReadOnlyMemory memory); + public static ReadOnlySpan Cast(ReadOnlySpan span) where TFrom : struct where TTo : struct; + public static Span Cast(Span span) where TFrom : struct where TTo : struct; + public static Memory CreateFromPinnedArray(T[] array, int start, int length); + public static ReadOnlySpan CreateReadOnlySpan(ref T reference, int length); + public static Span CreateSpan(ref T reference, int length); + public static ref T GetReference(ReadOnlySpan span); + public static ref T GetReference(Span span); + public static T Read(ReadOnlySpan source) where T : struct; + public static IEnumerable ToEnumerable(ReadOnlyMemory memory); + public static bool TryGetArray(ReadOnlyMemory memory, out ArraySegment segment); + public static bool TryGetMemoryManager(ReadOnlyMemory memory, out TManager manager) where TManager : MemoryManager; + public static bool TryGetMemoryManager(ReadOnlyMemory memory, out TManager manager, out int start, out int length) where TManager : MemoryManager; + public static bool TryGetString(ReadOnlyMemory memory, out string text, out int start, out int length); + public static bool TryRead(ReadOnlySpan source, out T value) where T : struct; + public static bool TryWrite(Span destination, ref T value) where T : struct; + public static void Write(Span destination, ref T value) where T : struct; + } - public struct OSPlatform : IEquatable + public readonly struct OSPlatform : IEquatable + public static class SequenceMarshal { + public static bool TryGetArray(ReadOnlySequence sequence, out ArraySegment segment); + public static bool TryGetReadOnlyMemory(ReadOnlySequence sequence, out ReadOnlyMemory memory); + public static bool TryGetReadOnlySequenceSegment(ReadOnlySequence sequence, out ReadOnlySequenceSegment startSegment, out int startIndex, out ReadOnlySequenceSegment endSegment, out int endIndex); + } } ```