Compartilhar via


ApplicationData.GetForPackageFamily(String) Method

Definition

Get an instance of ApplicationData for the specified package family for the current user.

public:
 static ApplicationData ^ GetForPackageFamily(Platform::String ^ packageFamilyName);
 static ApplicationData GetForPackageFamily(winrt::hstring const& packageFamilyName);
public static ApplicationData GetForPackageFamily(string packageFamilyName);
function getForPackageFamily(packageFamilyName)
Public Shared Function GetForPackageFamily (packageFamilyName As String) As ApplicationData

Parameters

packageFamilyName
String

Platform::String

winrt::hstring

Returns

Examples

The following example shows how to save data to the application data store for a specific package family:

void SaveData(string data)
{
    string packageFamilyName = "Fabrikam.Contoso_1234567890abc";
    var applicationData = ApplicationData.GetForPackageFamily(packageFamilyName);
    var filename = Path.Combine(applicationData.LocalPath, "applicationdata.dat");
    File.WriteAllText(filename, data, System.Text.UTF8Encoding);
}

Remarks

Note that this method is equivalent to Windows.Storage.ApplicationDataManager.CreateForPackageFamily().

Applies to

See also