看着:
member this.PostAndReply : (AsyncReplyChannel<'Reply> -> 'Msg) * ?int -> 'Reply
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么签名看起来对我来说非常直观.我们想要做的是向代理发布消息,然后等待回复.为什么我们必须给他一个奇怪的功能作为'信息'?
再次看到这个MSDN片段:
let rec loop() =
printf "> "
let input = Console.ReadLine()
printThreadId("Console loop")
let reply = agent.PostAndReply(fun replyChannel -> input, replyChannel)
if (reply <> "Stopping.") then
printfn "Reply: %s" reply
loop()
else
()
loop()
Run Code Online (Sandbox Code Playgroud)
我更喜欢这样的东西:
member this.PostAndReply : 'Msg * ?int -> 'Reply
Run Code Online (Sandbox Code Playgroud)
谢谢
看看http://msdn.microsoft.com/en-us/library/dd287191(v=vs.110).aspx,似乎它ConcurrentDictionary和System.Collections.Concurrent名称空间中的所有朋友都可以在可移植类库中使用.
但是,当我创建F#或C#可移植类库时,即使我显式添加引用mscorlib.dll,编译也会在使用时失败ConcurrentDictionary.
为什么?