I'm trying to refactor code and wondering if x?.ToString("C")
the same as $"{x:C}"
? Thanks!
EDIT:
The refactoring is part of changing the behavior of a legacy method named ToCurrencyString
. Currently, it's behavior is not the desired default for the whole application but we wouldn't like to change whatever calls it. Hope that makes sense.
EDIT 2:
forgot to include that x can be null
. Tried it and "${x:C}"
converts it to string.Empty
when x = null
.