String Constructor (Char*, Int32, Int32)
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#] [CLSCompliant(false)] unsafe public String( char* value, int startIndex, int length ); [C++] [CLSCompliant(false)] public: String( __wchar_t* value, int startIndex, int length );
[Visual Basic] This constructor cannot be used in Visual Basic.
[JScript] This constructor cannot be used in JScript.
Parameters [C#, C++]
- A pointer to an array of Unicode characters.
- The starting position within value.
- The number of characters within value to use.
Exceptions [C#, C++]
|ArgumentOutOfRangeException||startIndex or length is less than zero.
value is a null pointer and length is not zero.
Remarks [C#, C++]
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.
Requirements [C#, C++]
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard