I am encountering a problem which is how do I convert input strings like \"RED\" to the actual Color type Color.Red in C#. Is there a good way to do this?
This worked nicely for my needs ;) Hope someone can use it....
public static Color FromName(String name)
{
var color_props= typeof(Colors).GetProperties();
foreach (var c in color_props)
if (name.Equals(c.Name, StringComparison.OrdinalIgnoreCase))
return (Color)c.GetValue(new Color(), null);
return Colors.Transparent;
}