SpanMarshaller<T,TUnmanagedElement> 类

定义

重要

此 API 不符合 CLS。

支持从托管值封送 Span<T> 到元素的非托管值的连续本机数组。

generic <typename T, typename TUnmanagedElement>
 where TUnmanagedElement : value classpublic ref class SpanMarshaller abstract sealed
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.Marshalling.ContiguousCollectionMarshaller]
[System.Runtime.InteropServices.Marshalling.CustomMarshaller(typeof(System.Span<>), System.Runtime.InteropServices.Marshalling.MarshalMode.Default, typeof(System.Runtime.InteropServices.Marshalling.SpanMarshaller<,>))]
[System.Runtime.InteropServices.Marshalling.CustomMarshaller(typeof(System.Span<>), System.Runtime.InteropServices.Marshalling.MarshalMode.ManagedToUnmanagedIn, typeof(System.Runtime.InteropServices.Marshalling.SpanMarshaller<,>+ManagedToUnmanagedIn))]
public static class SpanMarshaller<T,TUnmanagedElement> where TUnmanagedElement : struct
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.Marshalling.ContiguousCollectionMarshaller>]
[<System.Runtime.InteropServices.Marshalling.CustomMarshaller(typeof(System.Span<>), System.Runtime.InteropServices.Marshalling.MarshalMode.Default, typeof(System.Runtime.InteropServices.Marshalling.SpanMarshaller<,>))>]
[<System.Runtime.InteropServices.Marshalling.CustomMarshaller(typeof(System.Span<>), System.Runtime.InteropServices.Marshalling.MarshalMode.ManagedToUnmanagedIn, typeof(System.Runtime.InteropServices.Marshalling.SpanMarshaller<,>+ManagedToUnmanagedIn))>]
type SpanMarshaller<'T, 'UnmanagedElement (requires 'UnmanagedElement : struct)> = class
Public Class SpanMarshaller(Of T, TUnmanagedElement)

类型参数

T

范围的托管元素类型。

TUnmanagedElement

范围元素的非托管类型。

继承
SpanMarshaller<T,TUnmanagedElement>
属性

注解

Span<T>使用此封送处理程序封送的 将匹配 的GetReference<T>(Span<T>)语义。 具体而言,如果范围是使用非null 值构造的,则此封送程序将为零长度范围传递非null 值。

方法

AllocateContainerForManagedElements(TUnmanagedElement*, Int32)

分配用于存储托管元素的空间。

AllocateContainerForUnmanagedElements(Span<T>, Int32)

分配用于存储非托管元素的空间。

Free(TUnmanagedElement*)

释放分配的非托管内存。

GetManagedValuesDestination(Span<T>)

获取应存储托管集合元素的空间范围。

GetManagedValuesSource(Span<T>)

获取托管集合元素的跨度。

GetUnmanagedValuesDestination(TUnmanagedElement*, Int32)

获取应存储非托管集合元素的空间范围。

GetUnmanagedValuesSource(TUnmanagedElement*, Int32)

获取本机集合元素的跨度。

适用于