Mono Class Library: System.String Overview | Members

System.String Constructor

Constructs and initializes a new instance of string . [Edit]

public String (char c, int count)

Parameters

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

Exceptions

TypeReason
ArgumentOutOfRangeExceptioncount is less than zero. [Edit]

Remarks

If the specified number is 0, string.Empty is created. [Edit]

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