-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Proposal]: Add overloads to Console.Write
that also take a ConsoleColor
parameter
#61731
Comments
Tagging subscribers to this area: @dotnet/area-system-console Issue DetailsBackground and motivationThis API proposal should just make it easier to write things of different colors to the console. Right now, we have to call three methods to do so. This is how we would do that now: Console.ForegroundColor = ConsoleColor.Blue;
Console.Write("Hello!");
Console.ResetColor(); This is what I propose: Console.Write(ConsoleColor.Blue, "Hello!"); This isn't anything critical, it's just some sugar to make writing code a little bit easier. API Proposalnamespace System
{
public static class Console
{
public void Write(ConsoleColor color, String value);
}
} I would suggest having an overload for API UsageSystem.Console.WriteLine(ConsoleColor.Red, "Red text!"); Alternative DesignsNo response RisksI do not see any risks associated with this.
|
Hi @FilipToth Thank you for your proposal. I am going to include this in #52374 which we may include in .NET 7 if the stars align. It would most probably be exposed by the new |
Ok, Great that would be awesome. Thank you. |
This is also a dup of #39746. |
I've not noticed that. In such a case I am going to close this issue. @FilipToth please follow #39746 and #52374 for updates. Thank you! |
Background and motivation
This API proposal should just make it easier to write things of different colors to the console. Right now, we have to call three methods to do so. This is how we would do that now:
This is what I propose:
This isn't anything critical, it's just some sugar to make writing code a little bit easier.
API Proposal
I would suggest having an overload for
Write
andWriteLine
.API Usage
Alternative Designs
No response
Risks
I do not see any risks associated with this.
The text was updated successfully, but these errors were encountered: