在F#类型提供程序中,如何向提供的类型添加静态类?

在F#类型提供程序中,如何向提供的类型添加静态类?,f#,type-providers,F#,Type Providers,如何将一个类型添加到另一个ProvidedType,并指定该类型为静态类?如何操作并不明显,但您所要做的就是以TypeAttributes的形式添加适当的元数据属性: //create a providedtype let myStaticType = ProvidedTypeDefinition("Tags", Some typeof<obj>, isErased = false) //set the TypeAttributes on the type myStaticType

如何将一个类型添加到另一个
ProvidedType
,并指定该类型为静态类?

如何操作并不明显,但您所要做的就是以
TypeAttributes
的形式添加适当的元数据属性:

//create a providedtype
let myStaticType = ProvidedTypeDefinition("Tags", Some typeof<obj>, isErased = false)

//set the TypeAttributes on the type
myStaticType.SetAttributes (TypeAttributes.Public ||| TypeAttributes.Class ||| TypeAttributes.Sealed ||| TypeAttributes.Abstract)

//Add the static type to another type
parentType.AddMember myStaticType
//创建提供的类型
让myStaticType=ProvidedTypeDefinition(“标记”,某些typeof,iSeries=false)
//设置类型的TypeAttributes
myStaticType.SetAttributes(TypeAttributes.Public | | | | TypeAttributes.Class | | | | TypeAttributes.Sealed | | TypeAttributes.Abstract)
//将静态类型添加到其他类型
parentType.AddMember myStaticType
静态类型只是具有抽象和密封的
TypeAttributes