Instead of displaying x item(s) found

from today on we use the following code

Console.WriteLine("{0} item{1} found.", count, count==1 ? "" : "s");

and get a nice output like

201 items found 

instead of

201 item(s) found 

 

From stackoverflow
http://stackoverflow.com/questions/9033/hidden-features-of-c/821718#821718

2 comments:

Peter Gfader said...

For easier globalization I would rather use:

Console.WriteLine("{0} {1} found.", cound, count==1 ? "item" : "items");

Subin Ninan said...

cool.

Post a Comment

Latest Posts

Popular Posts