Providing a Discriminated Union from an F# Type Provider

痴心易碎 提交于 2019-11-28 07:59:29

问题


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>)

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


回答1:


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



来源:https://stackoverflow.com/questions/20421160/providing-a-discriminated-union-from-an-f-type-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!