PostSharp 6.10 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Formatters Namespace / Char­Span Structure

CharSpan Structure

Represents a span of Char by encapsulating a substring or a range of a Char array.

Namespace:  PostSharp.Patterns.Formatters
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.10.14.0 (6.10.14.0)
Syntax
C#
public readonly struct CharSpan

The CharSpan type exposes the following members.

Constructors
  NameDescription
Public methodCharSpan(String)
Initializes a new CharSpan from a String, and takes the whole string.
Public methodCharSpan(Char[], Int32, Int32)
Initializes a new CharSpan from an array of Char.
Public methodCharSpan(String, Int32, Int32)
Initializes a new CharSpan from a String and specifies the start and lenght of the substring.
Properties
  NameDescription
Public propertyIsBackedByCharArray
Determines whether the current CharSpan is backed by a char[]. In this case, the ToCharArraySegment() method does not allocate memory.
Public propertyIsNull
Determines whether the current instance represents a null string.
Public propertyLength
Gets the number of Char in the span.
Methods
  NameDescription
Public methodStatic memberFromArraySegment
Converts a String into a CharSpan.
Public methodStatic memberFromString
Converts a String into a CharSpan.
Public methodToCharArraySegment
Converts the current CharSpan into an ArraySegment<T> of Char. When the IsBackedByCharArray or IsNull property is true, this method does not allocate memory.
Public methodToString
Returns the fully qualified type name of this instance.
(Overrides ValueType.ToString().)
Operators
  NameDescription
Public operatorStatic memberImplicit(ArraySegment<Char> to CharSpan)
Converts an ArraySegment<T> into a CharSpan.
Public operatorStatic memberImplicit(String to CharSpan)
Converts a String into a CharSpan.
See Also