Reputation: 4595
In Java I'd use the java.nio
library and use FileChannel.transferTo()
and FileChannel.transferFrom()
. Is there something similar in (specifically) C# or am I going to have to load some unamanaged .dll from somewhere? Google has not been useful in this case.
Edit: I should note that I'm targeting .NET 3.5.
Upvotes: 9
Views: 2979
Reputation: 4848
I think the best performing equivalent might be UnmanagedMemoryStream.
This class supports access to unmanaged memory using the existing stream-based model and does not require that the contents in the unmanaged memory be copied to the heap.
Although I've never had cause to do this, so can't vouch for appropriateness of this class (or of using unmanaged code/memory in your scenario).
Upvotes: 2