Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可以在 f# 中创建它吗?
public TTarget Map<TTarget>(string SQL) where TTarget : new() { }
let map<'T when 'T: (new: unit -> 'T)> (sql: string) = new 'T()
实际上,约束是不必要的。这同样有效。
let map (sql: string) = new 'T()