个性化阅读
专注于IT技术分析

F#属性

在F#中, 属性用于为程序代码构造启用元数据。属性可以应用于任何构造, 例如函数, 模块, 方法和类型。

句法:

[<target:attribute-name(arguments)>]

F#属性示例

open System
[<Obsolete("Do not use. Use newFunction instead.")>]
let updateSystem() = 
 printf "updating..."

updateSystem

输出:

attributes.fs(118, 1): warning FS0044: This construct is deprecated. Do not use. Use newFunction instead.
赞(0)
未经允许不得转载:srcmini » F#属性

评论 抢沙发

评论前必须登录!