The following code creates a repeating sequence of a certain char.
using System;
class Sample
{
public static void Main()
{
string s = new string('a', 5);
Console.WriteLine(s);
}
}
The output:
aaaaa
The following code creates string from character array.
using System;
class Sample
{
public static void Main()
{
char[] charArray = new char[] { 'j', 'a', 'v', 'a',
'2', 's', '.', 'c', 'o', 'm', };
string s = new string(charArray);
Console.WriteLine(s);
}
}
The output:
rntsoft.com