If I (in .NET / C #), for example, have a type variable long, I can convert it to a formatted string, for example:
long value = 12345;
string formattedValue = value.ToString("D10");
If I specify a format that is not valid for this type, I get an exception:
long value = 12345;
string formattedValue = value.ToString("Q10");
Question: Is there a way to check if the format specifier is valid (other than trying to format and catch the exception) before applying this format, is it something like long.IsFormatValid("Q10")?
Thanks for the help!
source
share