标签:
public class DataStorage { public async Task WriteFile(string key, object value) { try { var jsonValue = JsonConvert.SerializeObject(value); using (var file = await folder.OpenStreamForWriteAsync(key, CreationCollisionOption.ReplaceExisting)) using (var stream = new StreamWriter(file)) await stream.WriteAsync(jsonValue); } catch (Exception exception) { AsyncErrorHandler.HandleException(exception); } } }
public static class AsyncErrorHandler { public static void HandleException(Exception exception) { Debug.WriteLine(exception); } }
https://github.com/Fody/AsyncErrorHandler/blob/master/README.md
标签:
原文地址:http://www.cnblogs.com/zeroone/p/4865297.html