System Namespace String Class
Initializes a new instance of the String class to the value indicated by a specified pointer to an array of Unicode characters, a starting character position within that array, and a length.
This constructor is not CLS-compliant. For more information about CLS compliance, see What is the Common Language Specification.
[ C# ]
[ Serializable ]
unsafe public String (
char* value,
int startIndex,
int length
);
[ C++ ]
[ Serializable ]
public: String (
__wchar_t* value,
int startIndex,
int length
);
[ VB ] This constructor cannot be used in Visual Basic.
[ JScript ] This constructor cannot be used in JScript.
- value
- A pointer to an array of Unicode characters.
- startIndex
- The starting position within value.
- length
- The number of characters within value to use.
Exception Type |
Condition |
ArgumentOutOfRangeException |
startIndex or length is less than zero.
-or-
value is a null pointer and length is not zero.
|
If length is zero, an Empty instance is initialized.
This constructor copies Unicode characters from value, starting at startIndex and ending at ( startIndex + length- 1 ).
If the specified range is outside of the memory allocated for the sequence of characters, the behavior of this constructor is system dependent. For example, such a situation might cause an access violation.
In C#, this constructor is defined only in the context of unmanaged code.
String Members String Constructor Overload List Char Int32