Share via


String.ToCharArray Method (Int32, Int32)

Copies the characters in a specified substring of the current String object to an array of Unicode characters.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

[MethodImplAttribute]
public char [] ToCharArray (
         int startIndex,
         int length
)

Parameters

  • startIndex
    The starting index number in the current String object.
  • length
    The length of the substring in the current String object.

Return Value

A Unicode character array that is defined by the length and startIndex parameters.

Remarks

If the length parameter is 0 (zero), the entire string is copied, starting from the beginning of the current String object and ignoring the value of the startIndex parameter. If the current object is an empty string, the returned array is empty and has a length of 0.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

String Class
String Members
System Namespace