Print different length of spaces in C#

How can I print different length of spaces in C#?

Write(number*" ");

doesn't work here.

EDIT: But it works in Python.

Jon Skeet
people
quotationmark

Indeed, there's no * operator taking a string and an integer.

The simplest option is probably to use the string(char, int) constructor:

Write(new string(' ', number));

Depending on your actual use case, you might want to look at string.PadLeft and string.PadRight too, if you're actually trying to pad an existing string.

people

See more on this question at Stackoverflow