System.Char Extension Methods

Char.Repeat Method

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

Syntax

string Repeat(char @this,int repeatCount)

Parameters

@this
The @this to act on.
repeatCount
Number of repeats.

Examples


 // Copyright (c) 2013 Jonathan Magnan (http://zzzportal.com)
 // All rights reserved.
 // Licensed under MIT License (MIT)
 // License can be found here: https://zextensionmethods.codeplex.com/license
 
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Z;
 
 namespace ExtensionMethods.Examples
 {
     [TestClass]
     public class System_Char_Repeat
     {
         [TestMethod]
         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 6:48 PM by Jonathan_Magnan, version 1