Udostępnij za pośrednictwem


ResourceLoader.GetString(String) Method

Definition

Returns the most appropriate string value of a resource, specified by resource identifier, for the default ResourceContext of the view in which the ResourceLoader was obtained using ResourceLoader.GetForCurrentView.

Equivalent WinUI 2 API for UWP: Microsoft.Windows.ApplicationModel.Resources.ResourceLoader.GetString (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

public:
 virtual Platform::String ^ GetString(Platform::String ^ resource) = GetString;
winrt::hstring GetString(winrt::hstring const& resource);
public string GetString(string resource);
function getString(resource)
Public Function GetString (resource As String) As String

Parameters

resource
String

Platform::String

winrt::hstring

The resource identifier of the resource to be resolved.

Note

The resource identifier is treated as a Uniform Resource Identifier (URI) fragment, subject to Uniform Resource Identifier (URI) semantics. For example, getString ("Caption%20") is treated as getString ("Caption "). Do not use "?" or "#" in resource identifiers, as they terminate the named resource path. For example, "Foo?3" is treated as "Foo".

Returns

String

Platform::String

winrt::hstring

The most appropriate string value of the specified resource for the default ResourceContext.

Examples

See the example in ResourceLoader.

Remarks

Applies to

See also