提供来自F#类型提供者的有区别的联合 [英] Providing a Discriminated Union from an F# Type Provider

查看:81
本文介绍了提供来自F#类型提供者的有区别的联合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经掌握了类型提供程序的基础知识,例如创建类型

I've gotten the basics of type providers such as creating a type

let thisAssembly = Assembly.GetExecutingAssembly()
let t = ProvidedTypeDefinition(
           thisAssembly,namespaceName,
           xType.Attribute(xname "name").Value,
           baseType = Some typeof<obj>)

但是我需要能够定义记录类型和DU类型,是否可以使用类型提供程序来做到这一点?

but I need to be able to define record types and DU types is there any way to do this with type providers?

推荐答案

不幸的是,在类型提供程序中,无法定义任何F#特定类型,如歧视性联合,记录或模块,只能定义类和名称空间.有点不幸

Unfortunately, it's not possible to define any F# specific types like Discriminated Unions, Records, or Modules, in a type provider, only classes and namespaces, which is a bit unfortunate

这篇关于提供来自F#类型提供者的有区别的联合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆