string.Format
is a very risky method. There are a lot of thing that could go wrong, without any compilation errors:
string.Format("{0{", text);
string.Format("{1}", text);
string.Format("(0)", text);
string.Format("{0}", text1, text2);
I'm looking for a way to find this problems in compilation time. If I remember correctly, Resharper find some of those errors, but it's too rich for my blood.
Resharper does that for you -- even at edit time :-).
However be aware that things like
String.Format("{0} blabla", foo, bar);
Do not generate an error (after all, deciding to hide a value is perfectly fine).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With