C
C#2y ago
morry329#

❔ ✅ '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?)
'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.
Pastebin
UI_Console_DUP - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
9 Replies
Angius
Angius2y ago
color.Value.DrawingColor().Name color is of type ConsoleColor Well, ConsoleColor? You're pulling out it's value with .Value (without even checking if that value exists in the first place, by the by) So you get ConsoleColor
Angius
Angius2y ago
ConsoleColor Enum (System)
Specifies constants that define foreground and background colors for the console.
Angius
Angius2y ago
It's an enum It doesn't have methods No such thing as ConsoleColor.DrawingColor() exists
morry329#
morry329#OP2y ago
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
Angius2y ago
Yeah, don't use learning resources this outdated
morry329#
morry329#OP2y ago
I will try maybe FreeCodeCamp etc, a lot of people recommend me that
Angius
Angius2y ago
$helloworld
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server