How to

format a string

Published: 27. October 2011 | Updated: 27. October 2011
License: Microsoft Public License (MS-PL)
Categories: Framework » Strings
Tags: C# Formatting Text
Was this snippet helpful for you? YESYES / NONO
int arg0 = 25;
int arg1 = 300;

string formattedText = String.Format("Category contains {0} products. Catalog contains {1} products.", arg0, arg1);

Console.WriteLine(formattedText);
Console Output:
Category contains 25 products. Catalog contains 300 products.
Send us feedback about this snippet »



Related Snippets: