Open neptunao opened 5 years ago
Sure! However I don't want to drop .NET 4.0 compatibility for now and I still want the synchronous API side-by-side.
So maybe we could provide another assembly, specific to .NET 4.5 and .NET standard for async, based on a common IAsyncResult
, as you suggested?
Digging further, we can probably add *Async
methods with the current implementation so stay in .NET 4.0.
We can also include Async Targeting Pack, though I don't think that's a good idea. Probably the best way is to have IAsyncResult based approach in the main assembly, and have extension assembly for .NET >= 4.5 with Tasks from IAsyncResult.
There is probably no need to have a .NET 4.5 special assembly. If alternative methods return a Task
or Task<>
, it can be processed from a .NET 4.5 using async
/await
.
It would be really nice to have asynchronous API since this library provide an interface for network I/O. The best possible solution will be to target .NET >= 4.5 and use async/await pattern, but if it's not possible we can at least implement it using older patterns, as IAsyncResult.