Repeat

/// <summary>
/// Utility class for string manipulation.
/// </summary>
public static class CharExtensions
{
	/// <summary>
	/// Repeat the given char the specified number of times.
	/// </summary>
	/// <param name="input">The char to repeat.</param>
	/// <param name="count">The number of times to repeat the string.</param>
	/// <returns>The repeated char string.</returns>
	public static string Repeat(this char input, int count)
	{
		return new string(input, count);
	}
}
Example:
// write a line of 80 -'s to screen:
Console.WriteLine('-'.Repeat(80));

Description

Repeats a character a given number of times, a little cleaner shortcut than using the string constructor.

Details

Double click on the code to select all.

 

;