tarsave
  • Documentation
    • Introduction
    • Installation
    • How to Use
      • DataPersistenceConfig
      • Encryption
      • Compression
      • DataPersistenceBuilder
        • SetDataPersistenceConfig
        • Build
      • DataPersistenceService
        • Save
        • SaveAsync
        • AutoSaveAsync
        • Load
        • LoadAsync
        • Delete
        • DeleteAll
      • Transform Data
      • Audio Data
  • Log
    • Change Log
      • v1.0.6
      • v1.0.5
      • v1.0.4
      • v1.0.3
      • v1.0.2
Powered by GitBook
On this page
  1. Documentation
  2. How to Use
  3. DataPersistenceService

LoadAsync

Task<T> LoadAsync<T>(string key, CancellationToken cancellationToken = default)

Purpose: Loads data of type T asynchronously from a specified file path.

Parameters:

  • key: A string for the file path.

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

Return Value: Returns a Task that contains the loaded data of type T or null if loading fails.

public async Task LoadAsync()
{
    _data = await _dataPersistenceService.LoadAsync<Data>("Key", _cancellationToken);
}
PreviousLoadNextDelete

Last updated 6 months ago