Sometimes I want to repeat a given string several times for formatting purposes. The following code can be either made into an extension method with slight changes or a utility method:
1 | string .Join( "" , Enumerable.Repeat< string >( "a" , 8).ToArray());</ string >
|
The code above repeat "a" 8 times and returns "aaaaaaaa".
No comments:
Post a Comment