Read |
Unlike the official type it can be backed either by a managed array or by a native pointer. A managed array is never exposed through a raw pointer unless pinned: use TryGetArray(ArraySegmentT) or Pin. Span is available only for native-backed instances.
The ReadOnlyMemoryT type exposes the following members.
| Name | Description | |
|---|---|---|
| ReadOnlyMemoryT(T) | Creates a memory over the entirety of an array. A null array gives an empty memory. | |
| ReadOnlyMemoryT(Void*, Int32) | Creates a memory over native memory. The caller guarantees that the memory stays valid and fixed for the whole lifetime of the instance and of any copy of it. | |
| ReadOnlyMemoryT(T, Int32, Int32) | Creates a memory over a portion of an array. |
| Name | Description | |
|---|---|---|
| Empty | Gets an empty ReadOnlyMemoryT. | |
| IsEmpty | Gets a value indicating whether this memory is empty. | |
| IsNative | Gets a value indicating whether this memory is backed by native memory. | |
| Length | Gets the number of elements in the memory region. | |
| Span | Gets the span over this memory. Supported only for native-backed (or empty) instances: a managed array cannot be exposed through a raw pointer without pinning it. |
| Name | Description | |
|---|---|---|
| CopyTo | Copies the content into a destination array. | |
| Equals | Indicates whether this instance and a specified object are equal. (Inherited from ValueType) | |
| GetHashCode | Returns the hash code for this instance. (Inherited from ValueType) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| Pin | Pins the memory and returns a handle exposing a stable pointer to the first element. The handle must be disposed. For native-backed memory no pinning is needed. | |
| Slice(Int32) | Forms a slice starting at the specified index. | |
| Slice(Int32, Int32) | Forms a slice of the specified length starting at the specified index. | |
| ToArray | Copies the content into a new array. | |
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType) | |
| TryGetArray | Tries to get the underlying array segment. Returns false for native-backed memory. |
| Name | Description | |
|---|---|---|
| (ArraySegmentT to ReadOnlyMemoryT) | Implicitly converts an ArraySegmentT to a ReadOnlyMemoryT. | |
| (T to ReadOnlyMemoryT) | Implicitly converts an array to a ReadOnlyMemoryT. |
| Name | Description | |
|---|---|---|
| ConvertTReturn |
Converts a generic object
(Defined by JCOBridgeExtensions) | |
| ToNative |
Converts a generic input to an object manageable from the JVM
(Defined by JCOBridgeExtensions) |