-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add async for ExcelDataReader * Add ExcelDataWriter.CreateAsync
- Loading branch information
Showing
18 changed files
with
837 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Async Support | ||
|
||
ExcelDataReader and ExcelDataWriter both support "async" operations. | ||
In order to ensure proper async behavior, you must use the `CreateAsync` | ||
method to create instances. In this mode, the entire file must be | ||
buffered in memory, and all IO will be handled asynchronously. | ||
|
||
The CreateAsync methods are only supported on .NET Core versions. | ||
|
||
Reading: | ||
``` | ||
// this line will buffer the entire file into memory. | ||
await using var edr = ExcelDataReader.CreateAsync("jumbo.xlsx"); | ||
while(await edr.ReadAsync()) | ||
{ | ||
// ... | ||
} | ||
``` | ||
|
||
Writing: | ||
``` | ||
// must use async disposal | ||
await using var edw = ExcelDataWriter.CreateAsync("jumbo.xlsx"); | ||
edw.WriteAsync(myDataReader, "MyData"); | ||
edw.WriteAsync(myOtherDataReader, "MoreData"); | ||
// when the ExcelDataWriter is asynchronously disposed | ||
// the buffered file is asynchronously written to the output. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.