| title | Platform::StringReference Class | Microsoft Docs | |||||
|---|---|---|---|---|---|---|
| ms.custom | ||||||
| ms.date | 12/30/2016 | |||||
| ms.technology | cpp-windows | |||||
| ms.reviewer | ||||||
| ms.suite | ||||||
| ms.tgt_pltfrm | ||||||
| ms.topic | language-reference | |||||
| f1_keywords |
|
|||||
| dev_langs |
|
|||||
| ms.assetid | 2d09c7ec-0f16-458e-83ed-7225a1b9221e | |||||
| caps.latest.revision | 4 | |||||
| author | ghogen | |||||
| ms.author | ghogen | |||||
| manager | ghogen |
An optimization type that you can use to pass string data from Platform::String^ input parameters to other methods with a minimum of copy operations.
class StringReference | Name | Description |
|---|---|
| StringReference::StringReference | Two constructors for creating instances of StringReference. |
| Name | Description |
|---|---|
| StringReference::Data | Returns the string data as an array of char16 values. |
| StringReference::Length | Returns the number of characters in the string. |
| StringReference::GetHSTRING | Returns the string data as an HSTRING. |
| StringReference::GetString | Returns the string data as a Platform::String^. |
| Name | Description |
|---|---|
| StringReference::operator= | Assigns a StringReference to a new StringReference instance. |
| StringReference::operator() | Converts a StringReference to a Platform::String^. |
Minimum supported client: Windows 8
Minimum supported server: Windows Server 2012
Namespace: Platform
Header: vccorlib.h
Returns the contents of this StringReference as an array of char16 values.
const ::default::char16 * Data() const An array of char16 UNICODE text characters.
Returns the contents of the string as an __abi_HSTRING.
__abi_HSTRING GetHSTRING() const
An __abi_HSTRING that contains the string data.
Returns the contents of the string as a Platform::String^.
__declspec(no_release_return) __declspec(no_refcount)
::Platform::String^ GetString() const A Platform::String^ that contains the string data.
Returns the number of characters in the string.
unsigned int Length() const An unsigned integer that specifies the number of characters in the string.
Assigns the specified object to the current StringReference object.
StringReference& operator=(const StringReference& __fstrArg);
StringReference& operator=(const ::default::char16* __strArg); __fstrArg
The address of a StringReference object that is used to initialize the current StringReference object.
__strArg
Pointer to an array of char16 values that is used to initialize the current StringReference object.
A reference to an object of type StringReference.
Because StringReference is a standard C++ class and not a ref class, it does not appear in the Object Browser.
Converts a StringReference object to a Platform::String^ object.
__declspec(no_release_return) __declspec(no_refcount)
operator ::Platform::String^() const
A handle to an object of type Platform::String.
Initializes a new instance of the StringReference class.
StringReference();
StringReference(const StringReference& __fstrArg)
StringReference(const ::default::char16* __strArg)
StringReference(const ::default::char16* __strArg, size_t __lenArg) __fstrArg
The StringReference whose data is used to initialize the new instance.
__strArg
Pointer to an array of char16 values that is used to initialize the new instance.
__lenArg
The number of elements in __strArg.
The first version of this constructor is the default constructor. The second version initializes a new StringReference instance class from the object that's specified by the __fstrArg parameter. The third and fourth overloads initialize a new StringReference instance from an array of char16 values. char16 represents a 16-bit UNICODE text character.