在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.
评论前必须登录!
注册