String::Data Method

Returns a pointer to the beginning of the object's data buffer as a C-style array of char16 (wchar_t) elements.

    const char16* Data()

A pointer to the beginning of a const char16 array of Unicode characters (char16 is a typedef for wchar_t).

Use this method to convert from Platform::String^ to wchar_t*. When the String object goes out of scope, the Data pointer is no longer guaranteed to be valid. To store the data beyond the lifetime of the original String object, use wcscpy_s to copy the array into memory that you have allocated yourself.

Minimum supported client: Windows 8

Minimum supported server: Windows Server 2012

Namespace: Platform

Metadata: vccorlib.h

Show:
© 2014 Microsoft