Possible Duplicate:
Is there an easy way to return a string repeated X number of times?
In Python you can multiply sequences like this
fivespaces= ' ' * 5
Is there any built-in equivalent for this in C#? (without operator overloads or class extensions)
If it’s just a string then you can return multiples by passing in a count to
string()var fivespaces = new string(" ", 5);In the case where you want a collection of something else like a custom type, you can use
Enumerable.Repeatto get a collection:var items = Enumerable.Repeat(new SomeModel(), 5);