SaveAsync

SaveAsync<T>(string key, T data, CancellationToken cancellationToken = default)

Purpose: Saves data of type T asynchronously to a specified file path.

Parameters:

  • key: A string that specifies the file path.

  • data: The data to save, constrained to reference types (classes).

  • cancellationToken: A token to signal cancellation of the save operation.

Return Value: Returns a Task that indicates whether the save operation was successful.

Sample uses:

public async Task SaveAsync()
{
    bool result = await SaveManager.SaveAsync(DATA_KEY, _data, _cancellationToken);
}

Last updated