简体   繁体   English

F#abstractclass和abstractclassattribute之间有什么区别

[英]F# What is the difference between the abstractclass and abstractclassattribute

F# What is the difference between the [ <AbstractClass >] and [ <AbstractClassAttribute >], both seem to label a type as abstract. F#[ <AbstractClass >]和[ <AbstractClassAttribute >]之间有什么区别,两者似乎都将类型标记为抽象。

[ <AbstractClass >] https://msdn.microsoft.com/en-us/library/dd483471.aspx [ <AbstractClass >] https://msdn.microsoft.com/en-us/library/dd483471.aspx

[ <AbstractClassAttribute >] https://msdn.microsoft.com/en-us/library/ee370513.aspx [ <AbstractClassAttribute >] https://msdn.microsoft.com/en-us/library/ee370513.aspx

There is no difference, they both refer to AbstractClassAttribute . 没有区别,它们都引用了AbstractClassAttribute In F# (and C#), you can optionally omit the Attribute suffix when attaching an attribute with [<AttributeName>] . 在F#(和C#)中,您可以选择在使用[<AttributeName>]附加Attribute时省略Attribute后缀。

See: https://msdn.microsoft.com/en-us/library/dd233179.aspx#Anchor_1 请参阅: https//msdn.microsoft.com/en-us/library/dd233179.aspx#Anchor_1

Note that if you wished to refer to the attribute in normal code, you'd have to use the full name. 请注意,如果您希望在普通代码中引用该属性,则必须使用全名。

let example = AbstractClass() // ERROR
let example = AbstractClassAttribute() // OK

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM