.net - F# 和泛型类型

标签 .net f#

可以在 f# 中创建吗?

public TTarget Map<TTarget>(string SQL) where TTarget : new()
{
}

最佳答案

let map<'T when 'T: (new: unit -> 'T)> (sql: string) =
    new 'T()

关于.net - F# 和泛型类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13555039/

相关文章:

.net - .NET 4.5 和 F# 上 RX 的奇怪问题

.net - 我的 dotnet core Web 服务可以计算对其进行的调用次数吗?

c# - 在多个 .NET 应用程序中引用相同的连接字符串

f# - F# 函数应该放在模块、类还是其他结构中?

list - 为什么 Seq.tail 不是一个选项

.net - 使用 F# 查询 Entity Framework 的示例

.net - COM 互操作 .NET STA

.net - Visual Studio 扩展接口(interface)中未使用的方法

visual-studio - F# 断点仅在抛出异常后才起作用

c# - WCF 4.0 路由与 mex 使用 System.ServiceModel.Routing.RoutingService