Mono Class Library: System.String Overview | Members

System.String Constructor

Constructs and initializes a new instance of string .

public String (char c, int count)

Parameters

c
A char .
count
A int containing the number of occurrences of c.
count
Documentation for this section has not yet been entered.

Exceptions

TypeReason
ArgumentOutOfRangeExceptioncount is less than zero.

Remarks

If the specified number is 0, string.Empty is created.

Example

The following example demonstrates using this constructor.

C# Example

using System;

public class StringExample {
 public static void Main() {
 
 string s = new String('a', 10);

 Console.WriteLine(s);            
 }
}
   

The output is

aaaaaaaaaa

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0