Struct StyledText
Describes a text with mixed in styles. Can be used by WriteText(StyledText, bool).
Inherited Members
Namespace: Sharpie
Assembly: sharpie.dll
Syntax
[PublicAPI]
public readonly struct StyledText
Constructors
StyledText(string, Style)
Creates a new styled text with the given text
and style
.
Declaration
public StyledText(string text, Style style)
Parameters
Type | Name | Description |
---|---|---|
string | text | The text. |
Style | style | The text style. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
Plus(StyledText)
Combines this styled text with another styled text.
Declaration
public StyledText Plus(StyledText rhs)
Parameters
Type | Name | Description |
---|---|---|
StyledText | rhs | The other styled text to combine with. |
Returns
Type | Description |
---|---|
StyledText | The combined styled text. |
Plus(string, Style)
Combines this styled text with another styled text.
Declaration
public StyledText Plus(string text, Style style)
Parameters
Type | Name | Description |
---|---|---|
string | text | The other text to combine with. |
Style | style | The style of the text to combine with. |
Returns
Type | Description |
---|---|
StyledText | The combined styled text. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ToString()
Returns a string that represents the current object.
Declaration
public override string? ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
Operators
operator +(StyledText, StyledText)
Combines two styled texts together.
Declaration
public static StyledText operator +(StyledText lhs, StyledText rhs)
Parameters
Type | Name | Description |
---|---|---|
StyledText | lhs | The left hand side styled text to combine. |
StyledText | rhs | The left right side styled text to combine. |
Returns
Type | Description |
---|---|
StyledText | The combined styled text. |
operator ==(StyledText, StyledText)
Checks if two styled texts are equal.
Declaration
public static bool operator ==(StyledText lhs, StyledText rhs)
Parameters
Type | Name | Description |
---|---|---|
StyledText | lhs | The left hand side styled text. |
StyledText | rhs | The left right side styled .. |
Returns
Type | Description |
---|---|
bool | The result of the check. |
operator !=(StyledText, StyledText)
Checks if two styled texts are not equal.
Declaration
public static bool operator !=(StyledText lhs, StyledText rhs)
Parameters
Type | Name | Description |
---|---|---|
StyledText | lhs | The left hand side styled text. |
StyledText | rhs | The left right side styled .. |
Returns
Type | Description |
---|---|
bool | The result of the check. |