Can we use the string interpolation to convert a string to upper case, just like we use it with DateTime
object:
var str = $"Current date is {DateTime.Now:MM-dd-yyyy}";
Is there any string format modifier that can be passed after the :
to convert string to uppercase, knowing that the culture/localization is not important?
P.S. I'm looking for a way to do that without calling string.ToUpper
or ToUpperInvariant
methods, I know these methods, and I can use them.
I'm looking for a "shorthand" way of doing it, just like instead of writing:
DateTime.Now.ToString("MM-dd-yyyy")
You write instead:
$"Current date is {DateTime.Now:MM-dd-yyyy}";
If there is something like this it would be awesome: {somekindOfString:U}