1

I am converting a string to a Font using this approach:

var converter = TypeDescriptor.GetConverter(typeof(Font));
return (Font) converter.ConvertFromInvariantString(textValue);

I was hoping it would raise an exception if the textValue was an invalid font but it seems to just return a default font. How can I determine if the string is indeed a valid font?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Sam Mackrill
  • 4,004
  • 8
  • 35
  • 55

0 Answers0