AppInstance.FindOrRegisterForKey(String) Method

Definition

Registers an app instance with the platform, or finds an existing instance if another instance has already registered this key.

public:
 static AppInstance ^ FindOrRegisterForKey(Platform::String ^ key);
/// [Windows.Foundation.Metadata.Experimental]
 static AppInstance FindOrRegisterForKey(winrt::hstring const& key);
 static AppInstance FindOrRegisterForKey(winrt::hstring const& key);
[Windows.Foundation.Metadata.Experimental]
public static AppInstance FindOrRegisterForKey(string key);
public static AppInstance FindOrRegisterForKey(string key);
function findOrRegisterForKey(key)
Public Shared Function FindOrRegisterForKey (key As String) As AppInstance

Parameters

key
String

Platform::String

winrt::hstring

A non-empty string as a key for the instance.

Returns

An app instance that represents the first app that registered the key. The caller can determine whether that instance is the current instance.

Attributes

Remarks

Whereas the FindOrRegisterInstanceForKey method in the Windows OS is specific to instance redirection, this method in the Windows App SDK allows for the app to register a key for any reason.

After an app has registered with the platform, it is returned when other instances query for app instances.

An app instance can register multiple times with different keys. The system cache maintains one row per instance, therefore, the key is overwritten.

Applies to

See also