Things that I forget when I sneeze

Hello again, these days I’ve been noticing that there is a recurring thing that happens to me. I search online the most basic things because I forget them.

Let’s see… how do you elegantly concatenate a string? it was something with “some words {0}” … Gotd#x%it how was that?

And then you go on-line and search for it and find

Decimal pricePerOunce = 17.36m;
String s = String.Format("The current price is {0:C2} per ounce.",
pricePerOunce);
// Result if current culture is en-US:
// The current price is $17.36 per ounce.

And go: -Oh yeah! that’s it. An realize that you just lost 5-10 minutes of your life.

So I’ll start posting things like this at the section Things that I forget when I sneeze

ps: if you want to know more about Standard Numeric Format Strings you can check it out here

Leave a comment