I have two methods from two different third party libraries:
Task WriteToAsync(Stream stream);
Task LoadAsync(Stream stream);
I need to pipe data from source WriteTo
method to Load
method.
Currently next solution is used:
using (var stream = new MemoryStream()) {
await source.WriteToAsync(stream);
stream.Position = 0;
await destination.LoadAsync(stream);
}
Is there any better way?