diff --git a/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs b/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs index 433bb5a..58c60fa 100644 --- a/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs +++ b/samples/GeekLearning.Storage.BasicSample/Controllers/SampleController.cs @@ -17,14 +17,14 @@ public SampleController(IStorageFactory storageFactory) } [HttpGet] - public async Task> Get() + public async ValueTask> Get() { var summaries = await this.sharedAssets.ListAsync("summaries", "*.txt", recursive: true, withMetadata: false); return summaries.Select(x => x.Path); } [HttpGet] - public async Task Get(string path) + public async ValueTask Get(string path) { var summary = await this.sharedAssets.GetAsync(path); return await summary.ReadAllTextAsync(); diff --git a/samples/GeekLearning.Storage.BasicSample/Controllers/ValuesController.cs b/samples/GeekLearning.Storage.BasicSample/Controllers/ValuesController.cs index affe249..1550312 100644 --- a/samples/GeekLearning.Storage.BasicSample/Controllers/ValuesController.cs +++ b/samples/GeekLearning.Storage.BasicSample/Controllers/ValuesController.cs @@ -16,13 +16,13 @@ public ValuesController(TemplatesStore templates) } [HttpGet] - public async Task> Get() + public async ValueTask> Get() { return new string[] { await templates.Store.ReadAllTextAsync("json.json"), "value2" }; } [HttpGet("files")] - public async Task> Get(int id) + public async ValueTask> Get(int id) { var files = await templates.Store.ListAsync(""); return files.Select(x => x.PublicUrl); diff --git a/src/GeekLearning.Storage.Azure/AzureStore.cs b/src/GeekLearning.Storage.Azure/AzureStore.cs index 0554c2f..b345a9a 100644 --- a/src/GeekLearning.Storage.Azure/AzureStore.cs +++ b/src/GeekLearning.Storage.Azure/AzureStore.cs @@ -47,7 +47,7 @@ public Task InitAsync() return this.container.Value.CreateIfNotExistsAsync(accessType, null, null); } - public async Task ListAsync(string path, bool recursive, bool withMetadata) + public async ValueTask ListAsync(string path, bool recursive, bool withMetadata) { if (string.IsNullOrWhiteSpace(path)) { @@ -75,7 +75,7 @@ public async Task ListAsync(string path, bool recursive, bool return results.OfType().Select(blob => new Internal.AzureFileReference(blob, withMetadata: withMetadata)).ToArray(); } - public async Task ListAsync(string path, string searchPattern, bool recursive, bool withMetadata) + public async ValueTask ListAsync(string path, string searchPattern, bool recursive, bool withMetadata) { if (string.IsNullOrWhiteSpace(path)) { @@ -121,12 +121,12 @@ public async Task ListAsync(string path, string searchPattern, return filteredResults.Files.Select(x => pathMap[path + x.Path]).ToArray(); } - public async Task GetAsync(IPrivateFileReference file, bool withMetadata) + public async ValueTask GetAsync(IPrivateFileReference file, bool withMetadata) { return await this.InternalGetAsync(file, withMetadata); } - public async Task GetAsync(Uri uri, bool withMetadata) + public async ValueTask GetAsync(Uri uri, bool withMetadata) { return await this.InternalGetAsync(uri, withMetadata); } @@ -137,25 +137,25 @@ public async Task DeleteAsync(IPrivateFileReference file) await fileReference.DeleteAsync(); } - public async Task ReadAsync(IPrivateFileReference file) + public async ValueTask ReadAsync(IPrivateFileReference file) { var fileReference = await this.InternalGetAsync(file); return await fileReference.ReadInMemoryAsync(); } - public async Task ReadAllBytesAsync(IPrivateFileReference file) + public async ValueTask ReadAllBytesAsync(IPrivateFileReference file) { var fileReference = await this.InternalGetAsync(file); return await fileReference.ReadAllBytesAsync(); } - public async Task ReadAllTextAsync(IPrivateFileReference file) + public async ValueTask ReadAllTextAsync(IPrivateFileReference file) { var fileReference = await this.InternalGetAsync(file); return await fileReference.ReadAllTextAsync(); } - public async Task SaveAsync(byte[] data, IPrivateFileReference file, string contentType) + public async ValueTask SaveAsync(byte[] data, IPrivateFileReference file, string contentType) { using (var stream = new SyncMemoryStream(data, 0, data.Length)) { @@ -163,7 +163,7 @@ public async Task SaveAsync(byte[] data, IPrivateFileReference f } } - public async Task SaveAsync(Stream data, IPrivateFileReference file, string contentType) + public async ValueTask SaveAsync(Stream data, IPrivateFileReference file, string contentType) { var blockBlob = this.container.Value.GetBlockBlobReference(file.Path); @@ -182,7 +182,7 @@ public async Task SaveAsync(Stream data, IPrivateFileReference f return reference; } - public Task GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) + public ValueTask GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) { var adHocPolicy = new SharedAccessBlobPolicy() { @@ -191,7 +191,7 @@ public Task GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) Permissions = FromGenericToAzure(policy.Permissions), }; - return Task.FromResult(this.container.Value.GetSharedAccessSignature(adHocPolicy)); + return new ValueTask(this.container.Value.GetSharedAccessSignature(adHocPolicy)); } internal static SharedAccessBlobPermissions FromGenericToAzure(SharedAccessPermissions permissions) @@ -231,10 +231,9 @@ internal static SharedAccessBlobPermissions FromGenericToAzure(SharedAccessPermi return result; } - private async Task InternalGetAsync(IPrivateFileReference file, bool withMetadata = false) + private async ValueTask InternalGetAsync(IPrivateFileReference file, bool withMetadata = false) { - var azureFile = file as Internal.AzureFileReference; - if (azureFile != null) + if (file is Internal.AzureFileReference azureFile) { return azureFile; } @@ -242,7 +241,7 @@ internal static SharedAccessBlobPermissions FromGenericToAzure(SharedAccessPermi return await this.InternalGetAsync(new Uri(file.Path, UriKind.Relative), withMetadata); } - private async Task InternalGetAsync(Uri uri, bool withMetadata) + private async ValueTask InternalGetAsync(Uri uri, bool withMetadata) { try { diff --git a/src/GeekLearning.Storage.Azure/GeekLearning.Storage.Azure.csproj b/src/GeekLearning.Storage.Azure/GeekLearning.Storage.Azure.csproj index 05046db..3bb06fd 100644 --- a/src/GeekLearning.Storage.Azure/GeekLearning.Storage.Azure.csproj +++ b/src/GeekLearning.Storage.Azure/GeekLearning.Storage.Azure.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/GeekLearning.Storage.Azure/Internal/AzureFileReference.cs b/src/GeekLearning.Storage.Azure/Internal/AzureFileReference.cs index 01f60c8..eebbb59 100644 --- a/src/GeekLearning.Storage.Azure/Internal/AzureFileReference.cs +++ b/src/GeekLearning.Storage.Azure/Internal/AzureFileReference.cs @@ -43,12 +43,12 @@ public Task DeleteAsync() return this.CloudBlob.DeleteAsync(); } - public async Task ReadAsync() + public async ValueTask ReadAsync() { return await this.ReadInMemoryAsync(); } - public async Task ReadInMemoryAsync() + public async ValueTask ReadInMemoryAsync() { var memoryStream = new MemoryStream(); await this.CloudBlob.DownloadRangeToStreamAsync(memoryStream, null, null); @@ -66,7 +66,7 @@ public async Task ReadToStreamAsync(Stream targetStream) await this.CloudBlob.DownloadRangeToStreamAsync(targetStream, null, null); } - public async Task ReadAllTextAsync() + public async ValueTask ReadAllTextAsync() { using (var reader = new StreamReader(await this.CloudBlob.OpenReadAsync(AccessCondition.GenerateEmptyCondition(), new BlobRequestOptions(), new OperationContext()))) { @@ -74,7 +74,7 @@ public async Task ReadAllTextAsync() } } - public async Task ReadAllBytesAsync() + public async ValueTask ReadAllBytesAsync() { return (await this.ReadInMemoryAsync()).ToArray(); } @@ -84,7 +84,7 @@ public Task SavePropertiesAsync() return this.propertiesLazy.Value.SaveAsync(); } - public Task GetSharedAccessSignature(ISharedAccessPolicy policy) + public ValueTask GetSharedAccessSignature(ISharedAccessPolicy policy) { var adHocPolicy = new SharedAccessBlobPolicy() { @@ -93,7 +93,7 @@ public Task GetSharedAccessSignature(ISharedAccessPolicy policy) Permissions = AzureStore.FromGenericToAzure(policy.Permissions), }; - return Task.FromResult(this.CloudBlob.GetSharedAccessSignature(adHocPolicy)); + return new ValueTask(this.CloudBlob.GetSharedAccessSignature(adHocPolicy)); } } } diff --git a/src/GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem/Internal/ExtendedPropertiesProvider.cs b/src/GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem/Internal/ExtendedPropertiesProvider.cs index b5a639c..01e7a14 100644 --- a/src/GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem/Internal/ExtendedPropertiesProvider.cs +++ b/src/GeekLearning.Storage.FileSystem.ExtendedProperties.FileSystem/Internal/ExtendedPropertiesProvider.cs @@ -16,16 +16,16 @@ public ExtendedPropertiesProvider( this.options = options.Value; } - public Task GetExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file) + public ValueTask GetExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file) { var extendedPropertiesPath = this.GetExtendedPropertiesPath(storeAbsolutePath, file); if (!File.Exists(extendedPropertiesPath)) { - return Task.FromResult(new FileExtendedProperties()); + return new ValueTask(new FileExtendedProperties()); } var content = File.ReadAllText(extendedPropertiesPath); - return Task.FromResult(JsonConvert.DeserializeObject(content)); + return new ValueTask(JsonConvert.DeserializeObject(content)); } public Task SaveExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file, FileExtendedProperties extendedProperties) diff --git a/src/GeekLearning.Storage.FileSystem/FileSystemStore.cs b/src/GeekLearning.Storage.FileSystem/FileSystemStore.cs index dfa731b..13593fa 100644 --- a/src/GeekLearning.Storage.FileSystem/FileSystemStore.cs +++ b/src/GeekLearning.Storage.FileSystem/FileSystemStore.cs @@ -37,7 +37,7 @@ public Task InitAsync() return Task.FromResult(0); } - public async Task ListAsync(string path, bool recursive, bool withMetadata) + public async ValueTask ListAsync(string path, bool recursive, bool withMetadata) { var directoryPath = (string.IsNullOrEmpty(path) || path == "/" || path == "\\") ? this.AbsolutePath : Path.Combine(this.AbsolutePath, path); @@ -57,7 +57,7 @@ public async Task ListAsync(string path, bool recursive, bool return result.ToArray(); } - public async Task ListAsync(string path, string searchPattern, bool recursive, bool withMetadata) + public async ValueTask ListAsync(string path, string searchPattern, bool recursive, bool withMetadata) { var directoryPath = (string.IsNullOrEmpty(path) || path == "/" || path == "\\") ? this.AbsolutePath : Path.Combine(this.AbsolutePath, path); @@ -81,12 +81,12 @@ public async Task ListAsync(string path, string searchPattern, return result.ToArray(); } - public async Task GetAsync(IPrivateFileReference file, bool withMetadata) + public async ValueTask GetAsync(IPrivateFileReference file, bool withMetadata) { return await this.InternalGetAsync(file, withMetadata); } - public async Task GetAsync(Uri uri, bool withMetadata) + public async ValueTask GetAsync(Uri uri, bool withMetadata) { if (uri.IsAbsoluteUri) { @@ -102,25 +102,25 @@ public async Task DeleteAsync(IPrivateFileReference file) await fileReference.DeleteAsync(); } - public async Task ReadAsync(IPrivateFileReference file) + public async ValueTask ReadAsync(IPrivateFileReference file) { var fileReference = await this.InternalGetAsync(file); return await fileReference.ReadAsync(); } - public async Task ReadAllBytesAsync(IPrivateFileReference file) + public async ValueTask ReadAllBytesAsync(IPrivateFileReference file) { var fileReference = await this.InternalGetAsync(file); return await fileReference.ReadAllBytesAsync(); } - public async Task ReadAllTextAsync(IPrivateFileReference file) + public async ValueTask ReadAllTextAsync(IPrivateFileReference file) { var fileReference = await this.InternalGetAsync(file); return await fileReference.ReadAllTextAsync(); } - public async Task SaveAsync(byte[] data, IPrivateFileReference file, string contentType) + public async ValueTask SaveAsync(byte[] data, IPrivateFileReference file, string contentType) { using (var stream = new MemoryStream(data, 0, data.Length)) { @@ -128,7 +128,7 @@ public async Task SaveAsync(byte[] data, IPrivateFileReference f } } - public async Task SaveAsync(Stream data, IPrivateFileReference file, string contentType) + public async ValueTask SaveAsync(Stream data, IPrivateFileReference file, string contentType) { var fileReference = await this.InternalGetAsync(file, withMetadata: true, checkIfExists: false); this.EnsurePathExists(fileReference.FileSystemPath); @@ -148,15 +148,14 @@ public async Task SaveAsync(Stream data, IPrivateFileReference f return fileReference; } - public Task GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) + public ValueTask GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) { throw new NotSupportedException(); } - private async Task InternalGetAsync(IPrivateFileReference file, bool withMetadata = false, bool checkIfExists = true) + private async ValueTask InternalGetAsync(IPrivateFileReference file, bool withMetadata = false, bool checkIfExists = true) { - var fileSystemFile = file as Internal.FileSystemFileReference; - if (fileSystemFile != null) + if (file is Internal.FileSystemFileReference fileSystemFile) { return fileSystemFile; } @@ -164,7 +163,7 @@ public Task GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) return await this.InternalGetAsync(file.Path, withMetadata, checkIfExists); } - private async Task InternalGetAsync(string path, bool withMetadata, bool checkIfExists = true) + private async ValueTask InternalGetAsync(string path, bool withMetadata, bool checkIfExists = true) { var fullPath = Path.Combine(this.AbsolutePath, path); if (checkIfExists && !File.Exists(fullPath)) diff --git a/src/GeekLearning.Storage.FileSystem/IExtendedPropertiesProvider.cs b/src/GeekLearning.Storage.FileSystem/IExtendedPropertiesProvider.cs index 843de53..5785103 100644 --- a/src/GeekLearning.Storage.FileSystem/IExtendedPropertiesProvider.cs +++ b/src/GeekLearning.Storage.FileSystem/IExtendedPropertiesProvider.cs @@ -4,7 +4,7 @@ public interface IExtendedPropertiesProvider { - Task GetExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file); + ValueTask GetExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file); Task SaveExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file, Internal.FileExtendedProperties extendedProperties); } diff --git a/src/GeekLearning.Storage.FileSystem/Internal/FileSystemFileReference.cs b/src/GeekLearning.Storage.FileSystem/Internal/FileSystemFileReference.cs index 71dab02..59102d6 100644 --- a/src/GeekLearning.Storage.FileSystem/Internal/FileSystemFileReference.cs +++ b/src/GeekLearning.Storage.FileSystem/Internal/FileSystemFileReference.cs @@ -60,20 +60,19 @@ public Task DeleteAsync() return Task.FromResult(true); } - public Task ReadAllBytesAsync() + public ValueTask ReadAllBytesAsync() { - return Task.FromResult(File.ReadAllBytes(this.FileSystemPath)); + return new ValueTask(File.ReadAllBytes(this.FileSystemPath)); } - public Task ReadAllTextAsync() + public ValueTask ReadAllTextAsync() { - return Task.FromResult(File.ReadAllText(this.FileSystemPath)); + return new ValueTask(File.ReadAllText(this.FileSystemPath)); } - public Task ReadAsync() + public ValueTask ReadAsync() { - Stream stream = File.OpenRead(this.FileSystemPath); - return Task.FromResult(stream); + return new ValueTask(File.OpenRead(this.FileSystemPath)); } public async Task ReadToStreamAsync(Stream targetStream) @@ -105,7 +104,7 @@ public Task SavePropertiesAsync() (this.Properties as FileSystemFileProperties).ExtendedProperties); } - public Task GetSharedAccessSignature(ISharedAccessPolicy policy) + public ValueTask GetSharedAccessSignature(ISharedAccessPolicy policy) { throw new NotSupportedException(); } diff --git a/src/GeekLearning.Storage/GeekLearning.Storage.csproj b/src/GeekLearning.Storage/GeekLearning.Storage.csproj index d796858..d8fcbc9 100644 --- a/src/GeekLearning.Storage/GeekLearning.Storage.csproj +++ b/src/GeekLearning.Storage/GeekLearning.Storage.csproj @@ -15,6 +15,7 @@ + diff --git a/src/GeekLearning.Storage/IFileReference.cs b/src/GeekLearning.Storage/IFileReference.cs index 2d344a0..d852349 100644 --- a/src/GeekLearning.Storage/IFileReference.cs +++ b/src/GeekLearning.Storage/IFileReference.cs @@ -11,11 +11,11 @@ public interface IFileReference : IPrivateFileReference Task ReadToStreamAsync(Stream targetStream); - Task ReadAsync(); + ValueTask ReadAsync(); - Task ReadAllTextAsync(); + ValueTask ReadAllTextAsync(); - Task ReadAllBytesAsync(); + ValueTask ReadAllBytesAsync(); Task DeleteAsync(); @@ -23,6 +23,6 @@ public interface IFileReference : IPrivateFileReference Task SavePropertiesAsync(); - Task GetSharedAccessSignature(ISharedAccessPolicy policy); + ValueTask GetSharedAccessSignature(ISharedAccessPolicy policy); } } diff --git a/src/GeekLearning.Storage/IStore.cs b/src/GeekLearning.Storage/IStore.cs index 009147f..bf21425 100644 --- a/src/GeekLearning.Storage/IStore.cs +++ b/src/GeekLearning.Storage/IStore.cs @@ -10,26 +10,26 @@ public interface IStore Task InitAsync(); - Task ListAsync(string path, bool recursive, bool withMetadata); + ValueTask ListAsync(string path, bool recursive, bool withMetadata); - Task ListAsync(string path, string searchPattern, bool recursive, bool withMetadata); + ValueTask ListAsync(string path, string searchPattern, bool recursive, bool withMetadata); - Task GetAsync(IPrivateFileReference file, bool withMetadata); + ValueTask GetAsync(IPrivateFileReference file, bool withMetadata); - Task GetAsync(Uri file, bool withMetadata); + ValueTask GetAsync(Uri file, bool withMetadata); Task DeleteAsync(IPrivateFileReference file); - Task ReadAsync(IPrivateFileReference file); + ValueTask ReadAsync(IPrivateFileReference file); - Task ReadAllBytesAsync(IPrivateFileReference file); + ValueTask ReadAllBytesAsync(IPrivateFileReference file); - Task ReadAllTextAsync(IPrivateFileReference file); + ValueTask ReadAllTextAsync(IPrivateFileReference file); - Task SaveAsync(byte[] data, IPrivateFileReference file, string contentType); + ValueTask SaveAsync(byte[] data, IPrivateFileReference file, string contentType); - Task SaveAsync(Stream data, IPrivateFileReference file, string contentType); + ValueTask SaveAsync(Stream data, IPrivateFileReference file, string contentType); - Task GetSharedAccessSignatureAsync(ISharedAccessPolicy policy); + ValueTask GetSharedAccessSignatureAsync(ISharedAccessPolicy policy); } } diff --git a/src/GeekLearning.Storage/IStoreExtensions.cs b/src/GeekLearning.Storage/IStoreExtensions.cs index e6880c2..30f789f 100644 --- a/src/GeekLearning.Storage/IStoreExtensions.cs +++ b/src/GeekLearning.Storage/IStoreExtensions.cs @@ -5,31 +5,31 @@ public static class IStoreExtensions { - public static Task ListAsync(this IStore store, string path, bool recursive = false, bool withMetadata = false) + public static ValueTask ListAsync(this IStore store, string path, bool recursive = false, bool withMetadata = false) => store.ListAsync(path, recursive: recursive, withMetadata: withMetadata); - public static Task ListAsync(this IStore store, string path, string searchPattern, bool recursive = false, bool withMetadata = false) + public static ValueTask ListAsync(this IStore store, string path, string searchPattern, bool recursive = false, bool withMetadata = false) => store.ListAsync(path, searchPattern, recursive: recursive, withMetadata: withMetadata); public static Task DeleteAsync(this IStore store, string path) => store.DeleteAsync(new Internal.PrivateFileReference(path)); - public static Task GetAsync(this IStore store, string path, bool withMetadata = false) + public static ValueTask GetAsync(this IStore store, string path, bool withMetadata = false) => store.GetAsync(new Internal.PrivateFileReference(path), withMetadata: withMetadata); - public static Task ReadAsync(this IStore store, string path) + public static ValueTask ReadAsync(this IStore store, string path) => store.ReadAsync(new Internal.PrivateFileReference(path)); - public static Task ReadAllBytesAsync(this IStore store, string path) + public static ValueTask ReadAllBytesAsync(this IStore store, string path) => store.ReadAllBytesAsync(new Internal.PrivateFileReference(path)); - public static Task ReadAllTextAsync(this IStore store, string path) + public static ValueTask ReadAllTextAsync(this IStore store, string path) => store.ReadAllTextAsync(new Internal.PrivateFileReference(path)); - public static Task SaveAsync(this IStore store, byte[] data, string path, string contentType) + public static ValueTask SaveAsync(this IStore store, byte[] data, string path, string contentType) => store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType); - public static Task SaveAsync(this IStore store, Stream data, string path, string contentType) + public static ValueTask SaveAsync(this IStore store, Stream data, string path, string contentType) => store.SaveAsync(data, new Internal.PrivateFileReference(path), contentType); } } diff --git a/src/GeekLearning.Storage/Internal/GenericStoreProxy.cs b/src/GeekLearning.Storage/Internal/GenericStoreProxy.cs index 6c85671..c8582c0 100644 --- a/src/GeekLearning.Storage/Internal/GenericStoreProxy.cs +++ b/src/GeekLearning.Storage/Internal/GenericStoreProxy.cs @@ -27,24 +27,24 @@ public GenericStoreProxy(IStorageFactory factory, IOptions options) public Task DeleteAsync(IPrivateFileReference file) => this.innerStore.DeleteAsync(file); - public Task GetAsync(Uri file, bool withMetadata) => this.innerStore.GetAsync(file, withMetadata); + public ValueTask GetAsync(Uri file, bool withMetadata) => this.innerStore.GetAsync(file, withMetadata); - public Task GetAsync(IPrivateFileReference file, bool withMetadata) => this.innerStore.GetAsync(file, withMetadata); + public ValueTask GetAsync(IPrivateFileReference file, bool withMetadata) => this.innerStore.GetAsync(file, withMetadata); - public Task ListAsync(string path, bool recursive, bool withMetadata) => this.innerStore.ListAsync(path, recursive, withMetadata); + public ValueTask ListAsync(string path, bool recursive, bool withMetadata) => this.innerStore.ListAsync(path, recursive, withMetadata); - public Task ListAsync(string path, string searchPattern, bool recursive, bool withMetadata) => this.innerStore.ListAsync(path, searchPattern, recursive, withMetadata); + public ValueTask ListAsync(string path, string searchPattern, bool recursive, bool withMetadata) => this.innerStore.ListAsync(path, searchPattern, recursive, withMetadata); - public Task ReadAllBytesAsync(IPrivateFileReference file) => this.innerStore.ReadAllBytesAsync(file); + public ValueTask ReadAllBytesAsync(IPrivateFileReference file) => this.innerStore.ReadAllBytesAsync(file); - public Task ReadAllTextAsync(IPrivateFileReference file) => this.innerStore.ReadAllTextAsync(file); + public ValueTask ReadAllTextAsync(IPrivateFileReference file) => this.innerStore.ReadAllTextAsync(file); - public Task ReadAsync(IPrivateFileReference file) => this.innerStore.ReadAsync(file); + public ValueTask ReadAsync(IPrivateFileReference file) => this.innerStore.ReadAsync(file); - public Task SaveAsync(Stream data, IPrivateFileReference file, string contentType) => this.innerStore.SaveAsync(data, file, contentType); + public ValueTask SaveAsync(Stream data, IPrivateFileReference file, string contentType) => this.innerStore.SaveAsync(data, file, contentType); - public Task SaveAsync(byte[] data, IPrivateFileReference file, string contentType) => this.innerStore.SaveAsync(data, file, contentType); + public ValueTask SaveAsync(byte[] data, IPrivateFileReference file, string contentType) => this.innerStore.SaveAsync(data, file, contentType); - public Task GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) => this.innerStore.GetSharedAccessSignatureAsync(policy); + public ValueTask GetSharedAccessSignatureAsync(ISharedAccessPolicy policy) => this.innerStore.GetSharedAccessSignatureAsync(policy); } }