I want to write a function which will return FontStyle and take string as Parameter
FontStyle f = function ("Italic"); // FontStyles.Italic
I don’t want to write Switch case or if else statements to do the same.
Can it be done for case insensitive strings?
FontStyle f = function ("italic");
FontStyle f = function ("itAlic");
should return same.
You can use reflection for this: