This project has moved and is read-only. For the latest updates, please go here.

System.Char Extension Methods

Char.Repeat Method

A char extension method that repeats a character a number of times.


string Repeat(char @this,int repeatCount)


The @this to act on.
Number of repeats.


 // Copyright (c) 2013 Jonathan Magnan (
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here:
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 namespace ExtensionMethods.Examples
     public class System_Char_Repeat
         public void Repeat()
             // Type
             char @this = 'F';
             // Examples
             string value = @this.Repeat(3); // return "FFF";
             // Unit Test
             Assert.AreEqual("FFF", value);

Last edited Nov 23, 2013 at 7:48 PM by Jonathan_Magnan, version 1