[ACCEPTED]-C# String creation (specified length)-string
Accepted answer
You can use the string
constructor that takes a char
and an int
. It creates a string
instance with 1 the char
repeated the specified number of times.
As bdukes mentions there's constructor, that 6 takes a char and an int. That will construct 5 a string of the given length filled with 4 the char.
However, keep in mind, that strings 3 are immutable in .NET, so if you want to 2 create a specific string buffer, you should 1 use StringBuilder
instead.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.