Friday, April 10, 2009

How to fill String variable.

To fill a string variable, sometimes, they use next way:       const string breakLine = "----------";

Seems, next way (usage one of string’s constructor) will be better:

string line = new string('-', 10);
Console.WriteLine("new string('-', 10) >" + line);

 

Console Output:

image

1 comment:

Anonymous said...

Nice trick,
Hope I knew that before, would
have made much clearer code.

thx.