Mono Class Library: System.String Overview | Members

System.String Constructor

Constructs and initializes a new instance of string using a specified pointer to a sequence of Unicode characters, the index within that sequence at which to start copying characters, and the number of characters to be copied to construct the string .

[System.CLSCompliant(false)]
public String (char* value, int startIndex, int length)

Parameters

value
A pointer to an array of Unicode characters.
startIndex
A int containing the index within the array referenced by value from which to start copying.
length
A int containing the number of characters to copy from value to the new string. If length is zero, string.Empty is created.

Exceptions

TypeReason
ArgumentOutOfRangeException

startIndex or length is less than zero.

-or-

value is a null pointer and length is not zero.

Remarks

This member is not CLS-compliant. For a CLS-compliant alternative, use the string(char, int, int) constructor.

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.

Note: In C# this constructor is defined only in the context of unmanaged code.

Requirements

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