Struct SpanInt
Provides a type- and memory-safe representation of a contiguous region of arbitrary int array
Inherited Members
Namespace: System
Assembly: Iot.Device.CharacterLcd.dll
Syntax
public ref readonly struct SpanInt
Constructors
| Improve this Doc View SourceSpanInt(Int32[])
Creates a new System.SpanInt object over the entirety of a specified array.
Declaration
public SpanInt(int[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32[] | array | The array from which to create the System.Span object. |
SpanInt(Int32[], Int32, Int32)
Creates a new System.SpanInt object that includes a specified number of elements of an array starting at a specified index.
Declaration
public SpanInt(int[] array, int start, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32[] | array | The source array. |
| Int32 | start | The index of the first element to include in the new System.Span |
| Int32 | length | The number of elements to include in the new System.Span |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | array is null, but start or length is non-zero -or- start is outside the bounds of the array. -or-
|
Properties
| Improve this Doc View SourceEmpty
Returns an empty System.Span object.
Declaration
public static readonly SpanInt Empty { get; }
Property Value
| Type | Description |
|---|---|
| SpanInt |
IsEmpty
Returns a value that indicates whether the current System.Span is empty. true if the current span is empty; otherwise, false.
Declaration
public readonly bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Item[Int32]
Gets the element at the specified zero-based index.
Declaration
public readonly int this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | index | The zero-based index of the element. |
Property Value
| Type | Description |
|---|---|
| Int32 | The element at the specified index. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
Length
Returns the length of the current span.
Declaration
public readonly int Length { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Methods
| Improve this Doc View SourceCopyTo(SpanInt)
Copies the contents of this System.Span into a destination System.Span.
Declaration
public readonly void CopyTo(SpanInt destination)
Parameters
| Type | Name | Description |
|---|---|---|
| SpanInt | destination | The destination System.Span object. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | destination is shorter than the source SpanInt. |
Slice(Int32)
Forms a slice out of the current SpanInt that begins at a specified index.
Declaration
public readonly SpanInt Slice(int start)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | start | The index at which to begin the slice. |
Returns
| Type | Description |
|---|---|
| SpanInt | A span that consists of all elements of the current span from start to the end of the span. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
Slice(Int32, Int32)
Forms a slice out of the current SpanInt starting at a specified index for a specified length.
Declaration
public readonly SpanInt Slice(int start, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | start | The index at which to begin this slice. |
| Int32 | length | The desired length for the slice. |
Returns
| Type | Description |
|---|---|
| SpanInt | A SpanInt that consists of |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
|
ToArray()
Copies the contents of this SpanInt into a new array.
Declaration
public readonly int[] ToArray()
Returns
| Type | Description |
|---|---|
| Int32[] | An array containing the data in the current span. |
Operators
| Improve this Doc View SourceImplicit(Int32[] to SpanInt)
Implicit conversion of an array to a SpanInt.
Declaration
public static implicit operator SpanInt(int[] array)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32[] | array |
Returns
| Type | Description |
|---|---|
| SpanInt |