Possible Duplicate:
Is there an easy way to return a string repeated X number of times?
If I want to display a dot 10 times in Python, I could either use this:
print ".........."
or this
print "." * 10
How do I use the second method in C#? I tried variations of:
Console.WriteLine("."*10);
but none of them worked. Thanks.
You can use the string
constructor:
Console.WriteLine(new string('.', 10));
Initializes a new instance of the String class to the value indicated by a specified Unicode character repeated a specified number of times.
You can use one of the 'string' constructors, like so:
Console.WriteLine(new string('.', 10));
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