Show / Hide Table of Contents

    Struct SpanByte

    Provides a type- and memory-safe representation of a contiguous region of arbitrary byte array

    Inherited Members
    ValueType.Equals(Object)
    Object.ToString()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Namespace: System
    Assembly: mscorlib.dll
    Syntax
    [CLSCompliant(false)]
    public ref readonly struct SpanByte

    Constructors

    | Improve this Doc View Source

    SpanByte(Byte[])

    Creates a new System.SpanByte object over the entirety of a specified array.

    Declaration
    public SpanByte(byte[] array)
    Parameters
    Type Name Description
    Byte[] array

    The array from which to create the System.Span object.

    | Improve this Doc View Source

    SpanByte(Byte[], Int32, Int32)

    Creates a new System.SpanByte object that includes a specified number of elements of an array starting at a specified index.

    Declaration
    public SpanByte(byte[] array, int start, int length)
    Parameters
    Type Name Description
    Byte[] 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-

    start + length exceed the number of elements in the array.

    Properties

    | Improve this Doc View Source

    Empty

    Returns an empty System.Span object.

    Declaration
    public static readonly SpanByte Empty { get; }
    Property Value
    Type Description
    SpanByte
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    Item[Int32]

    Gets the element at the specified zero-based index.

    Declaration
    public readonly byte this[int index] { get; set; }
    Parameters
    Type Name Description
    Int32 index

    The zero-based index of the element.

    Property Value
    Type Description
    Byte

    The element at the specified index.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index is out of range.

    | Improve this Doc View Source

    Length

    Returns the length of the current span.

    Declaration
    public readonly int Length { get; }
    Property Value
    Type Description
    Int32

    Methods

    | Improve this Doc View Source

    CopyTo(SpanByte)

    Copies the contents of this System.Span into a destination System.Span.

    Declaration
    public readonly void CopyTo(SpanByte destination)
    Parameters
    Type Name Description
    SpanByte destination

    The destination System.Span object.

    Exceptions
    Type Condition
    ArgumentException

    destination is shorter than the source SpanByte.

    | Improve this Doc View Source

    Slice(Int32)

    Forms a slice out of the current SpanByte that begins at a specified index.

    Declaration
    public readonly SpanByte Slice(int start)
    Parameters
    Type Name Description
    Int32 start

    The index at which to begin the slice.

    Returns
    Type Description
    SpanByte

    A span that consists of all elements of the current span from start to the end of the span.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    start is < zero or > Length.

    | Improve this Doc View Source

    Slice(Int32, Int32)

    Forms a slice out of the current SpanByte starting at a specified index for a specified length.

    Declaration
    public readonly SpanByte 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
    SpanByte

    A SpanByte that consists of length number of elements from the current SpanByte starting at start.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    start or start + length is < zero or > Length.

    | Improve this Doc View Source

    ToArray()

    Copies the contents of this SpanByte into a new array.

    Declaration
    public readonly byte[] ToArray()
    Returns
    Type Description
    Byte[]

    An array containing the data in the current span.

    Operators

    | Improve this Doc View Source

    Implicit(Byte[] to SpanByte)

    Implicit conversion of an array to a SpanByte.

    Declaration
    public static implicit operator SpanByte(byte[] array)
    Parameters
    Type Name Description
    Byte[] array
    Returns
    Type Description
    SpanByte
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX