Struct SpanChar
Provides a type- and memory-safe representation of a contiguous region of arbitrary char array
Inherited Members
Namespace: System
Assembly: Iot.Device.CharacterLcd.dll
Syntax
public ref readonly struct SpanChar
Constructors
| Improve this Doc View SourceSpanChar(Char[])
Creates a new System.SpanChar object over the entirety of a specified array.
Declaration
public SpanChar(char[] array)
Parameters
Type | Name | Description |
---|---|---|
Char[] | array | The array from which to create the System.Span object. |
SpanChar(Char[], Int32, Int32)
Creates a new System.SpanChar object that includes a specified number of elements of an array starting at a specified index.
Declaration
public SpanChar(char[] array, int start, int length)
Parameters
Type | Name | Description |
---|---|---|
Char[] | 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 SpanChar Empty { get; }
Property Value
Type | Description |
---|---|
SpanChar |
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 char this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the element. |
Property Value
Type | Description |
---|---|
Char | 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(SpanChar)
Copies the contents of this System.Span into a destination System.Span.
Declaration
public readonly void CopyTo(SpanChar destination)
Parameters
Type | Name | Description |
---|---|---|
SpanChar | destination | The destination System.Span object. |
Exceptions
Type | Condition |
---|---|
ArgumentException | destination is shorter than the source SpanChar. |
Slice(Int32)
Forms a slice out of the current SpanChar that begins at a specified index.
Declaration
public readonly SpanChar Slice(int start)
Parameters
Type | Name | Description |
---|---|---|
Int32 | start | The index at which to begin the slice. |
Returns
Type | Description |
---|---|
SpanChar | 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 SpanChar starting at a specified index for a specified length.
Declaration
public readonly SpanChar 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 |
---|---|
SpanChar | A SpanChar that consists of |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|
ToArray()
Copies the contents of this SpanChar into a new array.
Declaration
public readonly char[] ToArray()
Returns
Type | Description |
---|---|
Char[] | An array containing the data in the current span. |
Operators
| Improve this Doc View SourceImplicit(Char[] to SpanChar)
Implicit conversion of an array to a SpanChar.
Declaration
public static implicit operator SpanChar(char[] array)
Parameters
Type | Name | Description |
---|---|---|
Char[] | array |
Returns
Type | Description |
---|---|
SpanChar |