CSharp examples for System:Char
Generate a string by duplicating a char.
using Microsoft.Win32; using System.Text; using System.IO;/* w ww . ja v a 2s . c om*/ using System; public class Main{ /// <summary> /// Generate a string by duplicating <see cref="char"/> xch. /// </summary> /// <param name="len">duplicate times.</param> /// <param name="xch">the duplicated character.</param> /// <returns></returns> public static string GenStr(int len, char xch) { char[] ch = new char[len]; for (int i = 0; i<len; i++) { ch[i] = xch; } return new string(ch); } }