Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: ConsoleColoredString ColorSubstring(this string, int, int, ConsoleColor?, ConsoleColor?)

Declaration

public static ConsoleColoredString ColorSubstring(
    this string str,
    int index,
    int length,
    ConsoleColor? foreground,
    ConsoleColor? background = null
)

Summary

Colors the specified range within the specified string in a specified color.

Parameters

this stringstr The string to partially colour.
intindex The index at which to start colouring.
intlength The number of characters to colour.
ConsoleColor?foreground The foreground color to assign to the range of characters.
ConsoleColor?background The background color to assign to the range of characters.

Returns

A potentially colorful string.