ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods


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


/// <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);


// write a line of 80 -'s to screen:

Author: James Michael Hare (BlackRabbitCoder)

Submitted on: 14 okt 2010

Language: C#

Type: System.Char

Views: 5130