struct · System
Span<T>
public struct System.Span<T>
A run of an array's elements, seen in place: span[i] reads and writes the array, Slice makes a smaller view,
nothing is copied. A view of a list sees its elements until the list grows.
- Kind
- struct
- Namespace
- System
- Assembly
- System.Core
- Access
- public
- Source file
Span.ant
Type parameters
| Name | Constraints |
|---|---|
T | any type |
Constructors
constructor Span(array: T[])
#
The whole array.
count elements of the array from from.
Properties
property Items: T[]
#
The array under the view and where the view starts in it (for code that works on arrays).
Methods
span[i].
span[i] = value.
method Slice(from: i32) -> System.Span<T>
#
The view from from to the end, and count elements from from.
method Slice(from: i32, count: i32) -> System.Span<T>
#
method ToArray() -> T[]
#
A new array with the elements.
method CopyTo(target: System.Span<T>) -> void
#
Copies the elements into target (at least as long).
method Fill(value: T) -> void
#
Every element set to value.
method Iterator() -> System.SpanIterator<T>
#
Private and internal members (4)
Source
Span<T> as Larva HIR, decompiled from its Larva HIR.
// A run of an array's elements, seen in place: `span[i]` reads and writes the array, Slice makes a smaller view,
// nothing is copied. A view of a list sees its elements until the list grows.
public struct System.Span<T>
{
field items: T[]
field start: i32
field length: i32
static method OutOfRange() -> void
// The whole array.
constructor Span(array: T[])
// `count` elements of the array from `from`.
constructor Span(array: T[], from: i32, count: i32)
// `span[i]`.
method At(index: i32) -> T
// `span[i] = value`.
method SetAt(index: i32, value: T) -> void
// The view from `from` to the end, and `count` elements from `from`.
method Slice(from: i32) -> System.Span<T>
method Slice(from: i32, count: i32) -> System.Span<T>
// A new array with the elements.
method ToArray() -> T[]
// Copies the elements into `target` (at least as long).
method CopyTo(target: System.Span<T>) -> void
// Every element set to `value`.
method Fill(value: T) -> void
method Iterator() -> System.SpanIterator<T>
property Length: i32
property IsEmpty: bool
// The array under the view and where the view starts in it (for code that works on arrays).
property Items: T[]
property Start: i32
}