I am a C# programmer, but I have a question about Async Workflows in F#. Supposing I have the following class in a C# class library:
class File {
IAsyncResult BeginReadAll(string fileName, AsyncCallback callback, object state){}
string EndReadAll(IAsyncResult result){}
}
My understanding is that is possible in F# for me to make a function called ReadAllAsync that I can call like this:
async { let! rsp = ReadAllAsync() }
and that it will not block the calling thread but rather release it to the thread pool and then return on another thread when the operation finishes. I think I understand how to code this in F# using Async.Primitive, but my question is: can I call this ReadAllAsync function from C# code? If so, how do I package the F# code in a class library to access from C#?