TextSpan Struct

A part of a RichText that has one style.

public readonly struct TextSpan : IEquatable<TextSpan>
Implements

Properties

NameDescription
IsPlaceholderGets a value indicating whether the span is a placeholder: one character (U+FFFC) that takes, in its line, the room of what the caller draws there. See RichTextBuilder.AppendPlaceholder.
LengthGets the number of characters of the span, in UTF-16 code units.
StartGets the index of the first character of the span in the text.
StyleGets the style of the span.

IsPlaceholder

TextSpan.cs

Gets a value indicating whether the span is a placeholder: one character (U+FFFC) that takes, in its line, the room of what the caller draws there. See RichTextBuilder.AppendPlaceholder.

public bool IsPlaceholder { get; }

Property value

bool

Gets the number of characters of the span, in UTF-16 code units.

public int Length { get; }

Property value

int

Gets the index of the first character of the span in the text.

public int Start { get; }

Property value

int

Gets the style of the span.

public TextStyle Style { get; }

Property value

TextStyle

Methods

NameDescription
Equals(TextSpan)Indicates whether the current object is equal to another object of the same type.
Equals(object?)Indicates whether this instance and a specified object are equal.
GetHashCode()Returns the hash code for this instance.

Equals overloads

Equals(TextSpan)

TextSpan.cs

Indicates whether the current object is equal to another object of the same type.

public bool Equals(TextSpan other)
Parameters
other TextSpan
An object to compare with this object.
Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

TextSpan.cs

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)
Parameters
obj object?
The object to compare with the current instance.
Returns

bool true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

TextSpan.cs

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int A 32-bit signed integer that is the hash code for this instance.

Operators

NameDescription
operator ==(TextSpan, TextSpan)Determines whether two spans are the same part of a text with the same style.
operator !=(TextSpan, TextSpan)Determines whether two spans differ.

operator ==(TextSpan, TextSpan)

TextSpan.cs

Determines whether two spans are the same part of a text with the same style.

public static bool operator ==(TextSpan left, TextSpan right)

Parameters

left TextSpan
right TextSpan

Returns

bool

operator !=(TextSpan, TextSpan)

TextSpan.cs

Determines whether two spans differ.

public static bool operator !=(TextSpan left, TextSpan right)

Parameters

left TextSpan
right TextSpan

Returns

bool