String Constructors
The String class itself has eight constructors. If you look in the Object Browser, you’ll find that
five of these use pointers and are not safe under the rules of the Common Language Specification
(CLS) that .NET languages must follow.
The unsafe constructors are not discussed here. The remaining three safe String overloaded constructor
methods are shown in the table below.
Table: Overloaded Safe String Class Constructors
|
Method
|
Meaning
|
|
String (char, int)
|
Creates a string consisting of a char
repeating int times.
|
|
String (char[])
|
Creates a string from a char array.
|
|
String (char[], int, int)
|
Create a string from a char array with
a start position and length.
|
|