dotnet-core/release-notes/2.1/api-diff/2.0-vs-2.1_System.Runtime.InteropServices.md

36 lines
2.5 KiB
Markdown
Raw Normal View History

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