摘要:
你可能需要在dllImport代码中使用泛型类。但是你知道下面的代码段能通过编译么?1 open System.Runtime.InteropServices2 3 type B<'T>() = 4 member this.F() = ()5 6 module A = 7 [<DllImport("aa")>]8 extern void AA(B<int> a)答案是否定的。注意最后一行将抛出一个错误:Unexpected type application in extern declaration. Expected ' 阅读全文
摘要:
以下代码在VS2012中不能通过编译,你知道么?知道为什么么? 1 let f0 x = x % 2 = 0 2 let f1 x = x % 2 <> 0 3 4 let ( | Even | _ | ) f (x:int) = if f(x) then Some(Math.Sign(x)) else None 5 let ( | Odd | _ | ) f (x:int) = if f(x) then Some(Math.Sign(x)) else None 6 7 let f (x:int) = 8 match x with 9 | Even (fun x -> ... 阅读全文
摘要:
在现在的Visual Studio 2012中,F#智能感应有时候在某些情况下不能工作。那么在何种情况下它会不工作呢?可以绕过去么?让我来告诉你详细情况吧。请看如下代码: 1 open System.Collections.ObjectModel 2 3 module PortableLibrary1 = 4 type Keys = 5 | One = 1 6 | Two = 2 7 | Three = 3 8 | Four = 4 9 | Five = 510 | Six = 611 | Seven = 712 |... 阅读全文