Read |
This type is provided solely to allow JCOBridge public APIs that expose ReadOnlySpanT (such as AsSpan and AsSpan) to compile and function correctly on .NET Framework without any external dependency.
The span can be backed by a managed array (the reference is tracked by the GC, so the array can be moved safely) or by native memory (the caller guarantees that the memory stays valid and fixed for the lifetime of the span). A raw pointer is never stored for a managed array: it is pinned only for the duration of each operation that needs it.
JCOBridge HPA edition on .NET Framework uses the official System.ReadOnlySpan<T> from the System.Memory NuGet package, which provides the full runtime-optimised implementation including SIMD support.
Users targeting .NET 5+ or .NET Standard 2.1 always receive the official runtime type — this shim is never compiled into those targets.
The ReadOnlySpanT type exposes the following members.
| Name | Description | |
|---|---|---|
| ReadOnlySpanT(T) | Creates a new ReadOnlySpanT over the entirety of a target array. | |
| ReadOnlySpanT(Void*, Int32) | Creates a new ReadOnlySpanT from a raw pointer and a length. The caller guarantees that the memory stays valid and fixed for the lifetime of the span. | |
| ReadOnlySpanT(T, Int32, Int32) | Creates a new ReadOnlySpanT that includes a specified number of elements of an array starting at a specified index. |
| Name | Description | |
|---|---|---|
| Empty | Gets an empty ReadOnlySpanT. | |
| IsEmpty | Gets a value indicating whether this span is empty. | |
| Item | Returns the element at the specified index. |
| Name | Description | |
|---|---|---|
| CastUpTDerived |
Not supported on .NET Framework.
CastUp<TDerived> exists for reference-type covariance (e.g. ReadOnlySpan<string> → ReadOnlySpan<object>), which is incompatible with the where T : unmanaged constraint required by this shim. Unmanaged types are never reference types and therefore covariant casting is meaningless in this context. Obsolete | |
| CopyTo(SpanT) | Copies the contents of this span into a destination SpanT. Overlapping regions are handled correctly. | |
| CopyTo(T, Int32) | Copies the contents of this span into a destination array. | |
| Equals | Indicates whether this instance and a specified object are equal. (Inherited from ValueType) | |
| GetEnumerator | Returns an enumerator for this span, enabling foreach support. | |
| GetHashCode | Returns the hash code for this instance. (Inherited from ValueType) | |
| GetPinnableReference | Returns a reference to the first element for use with the fixed statement. Not intended to be called by user code. | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| SequenceEqual | Determines whether this span and other contain the same sequence of elements. | |
| Slice(Int32) | Forms a slice out of the current span starting at the specified index. | |
| Slice(Int32, Int32) | Forms a slice out of the current span starting at the specified index for the specified length. | |
| ToArray | Copies the contents of this span into a new array. | |
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType) | |
| TryCopyTo | Attempts to copy the contents of this span into a destination SpanT and returns a value indicating whether the operation succeeded. |
| Name | Description | |
|---|---|---|
| (ArraySegmentT to ReadOnlySpanT) | Implicitly converts an ArraySegmentT to a ReadOnlySpanT. | |
| (T to ReadOnlySpanT) | Implicitly converts a T array to a ReadOnlySpanT. |
| 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) |