SpanT Structure |
This type is provided solely to allow JCOBridge public APIs that expose SpanT (such as AsWritableSpan and AsWritableSpan) 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.Span<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 SpanT type exposes the following members.
| Name | Description | |
|---|---|---|
| SpanT(T) | Creates a new SpanT over the entirety of a target array. | |
| SpanT(Void*, Int32) | Creates a new SpanT from a raw pointer and a length. The caller guarantees that the memory stays valid and fixed for the lifetime of the span. | |
| SpanT(T, Int32, Int32) | Creates a new SpanT that includes a specified number of elements of an array starting at a specified index. |
| Name | Description | |
|---|---|---|
| Empty | Gets an empty SpanT. | |
| IsEmpty | Gets a value indicating whether this span is empty. | |
| Item | Gets or sets the element at the specified index. |
| Name | Description | |
|---|---|---|
| Clear | Clears the contents of this span by setting all elements to the default value of T. | |
| CopyTo | Copies the contents of this span into a destination SpanT. Overlapping regions are handled correctly. | |
| Equals |
Not supported. Throws NotSupportedException.
(Overrides ValueTypeEquals(Object)) Obsolete | |
| Fill | Fills all elements of this span with the specified value. | |
| GetEnumerator | Returns an enumerator for this span, enabling foreach support. | |
| GetHashCode |
Not supported. Throws NotSupportedException.
(Overrides ValueTypeGetHashCode) Obsolete | |
| GetPinnableReference | Returns a reference to the first element for use with the fixed statement. | |
| 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 string representation of this SpanT.
(Overrides ValueTypeToString) | |
| TryCopyTo | Attempts to copy the contents of this span into a destination SpanT and returns a value indicating whether the operation succeeded. |
| Name | Description | |
|---|---|---|
| Equality(SpanT, SpanT) | Returns a value that indicates whether two SpanT instances refer to the same memory with the same length. | |
| (ArraySegmentT to SpanT) | Implicitly converts an ArraySegmentT to a SpanT. | |
| (T to SpanT) | Implicitly converts a T array to a SpanT. | |
| (SpanT to ReadOnlySpanT) | Implicitly converts a SpanT to a ReadOnlySpanT. | |
| Inequality(SpanT, SpanT) | Returns a value that indicates whether two SpanT instances are not equal. |
| 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) |