Struct FormattedChar
- Namespace
- InteractiveReadLine.Formatting
- Assembly
- InteractiveReadLine.dll
A struct representing a single character and its foreground and background colors. Null colors represents the system defaults.
public struct FormattedChar : IEquatable<FormattedChar>
- Implements
- Inherited Members
Constructors
FormattedChar(char, ConsoleColor?, ConsoleColor?)
Creates a character with the specified foreground and background colors. Either color can be null to use the display default.
public FormattedChar(char c, ConsoleColor? foreground, ConsoleColor? background)
Parameters
ccharThe character.
foregroundConsoleColor?The foreground color, or null to use the display default.
backgroundConsoleColor?The background color, or null to use the display default.
Properties
Background
Gets the background color, or null when the display default should be used.
public readonly ConsoleColor? Background { get; }
Property Value
Char
Gets the character without its formatting.
public readonly char Char { get; }
Property Value
Foreground
Gets the foreground color, or null when the display default should be used.
public readonly ConsoleColor? Foreground { get; }
Property Value
Methods
Equals(FormattedChar)
Determines whether this instance and another formatted character have the same character and colors.
public bool Equals(FormattedChar other)
Parameters
otherFormattedChar
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
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.