C#
C#

help

Root Question Message

morry329
morry3292/7/2023
❔ ✅ 'ConsoleColor' does not contain a definition for 'DrawingColor'

I am experimenting a sample code to create a colourful UI on console, and am getting this error:
'ConsoleColor' does not contain a definition for 'DrawingColor' and no accessible extension method 'DrawingColor' accepting a first argument of type 'ConsoleColor' could be found (are you missing a using directive or an assembly reference?)
`

My current code is here https://pastebin.com/tHvqkYLu

Could anyone kindly help me with some clues or hints? I have tried System.Drawing.Color or just the name of the color like Cyan, none of these worked.
Angius
Angius2/7/2023
color.Value.DrawingColor().Name
Angius
Angius2/7/2023
color is of type ConsoleColor
Angius
Angius2/7/2023
Well, ConsoleColor?
Angius
Angius2/7/2023
You're pulling out it's value with .Value (without even checking if that value exists in the first place, by the by)
Angius
Angius2/7/2023
So you get ConsoleColor
Angius
Angius2/7/2023
It's an enum
Angius
Angius2/7/2023
It doesn't have methods
Angius
Angius2/7/2023
No such thing as ConsoleColor.DrawingColor() exists
morry329
morry3292/7/2023
Thanks a lot - I think I had a bad code example, this code isn't mine (although it came from the ASP.NET 2.0 era whilst I use NET 6.0 ) So there is a lot of discrepancies, I had to change a lot of source codes from this book a lot. Like I try to find a way with a blindfold. I am pretty sure there is a good example on the web, see if I find out the correct course like Udemy
Angius
Angius2/7/2023
Yeah, don't use learning resources this outdated
morry329
morry3292/7/2023
I will try maybe FreeCodeCamp etc, a lot of people recommend me that
Angius
Angius2/7/2023
$helloworld
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy