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)

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

适用于