Console.WriteLine("Enter the Name of Color in Which do You Want to Print"); string str = Console.ReadLine(); Console.ForegroundColor = (ConsoleColor) str;
ShilpaKumario wrote:Console.ForegroundColor = (ConsoleColor) str;
(ConsoleColor) Enum.Parse(typeof(ConsoleColor), str);
Console.WriteLine("Enter the Name of Color in Which do You Want to Print"); string str = Console.ReadLine(); Console.ForegroundColor =(ConsoleColor) Enum.Parse(typeof(ConsoleColor), str,true); Console.Read()
Console.ForegroundColor = (ConsoleColor)Enum.Parse(typeof(ConsoleColor), str); // Parse is used to convert value to equivalent enumerated object.
ColorConverter conv = new ColorConverter(); conv.ConvertFromString("Red");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)