此特性有两个用途。 当应用于程序集时,必须为其提供一个字符串参数,并且此参数必须指示该程序集中的有效模块或命名空间。 通过对此程序集的引用编译的源代码文件将在自动打开给定路径的环境中处理。
**命名空间/模块路径:**Microsoft.FSharp.Core
程序集:FSharp.Core(在 FSharp.Core.dll 中)
[<AttributeUsage(AttributeTargets.Class ||| AttributeTargets.Assembly, AllowMultiple = true)>] [<Sealed>] type AutoOpenAttribute = class new AutoOpenAttribute : string -> AutoOpenAttribute new AutoOpenAttribute : unit -> AutoOpenAttribute member this.Path : string end
备注
应用于程序集中的模块时,不能为特性提供任何参数。 在用户源代码中打开外层命名空间时,也会隐式打开模块。
也可以使用名称的缩写形式 AutoOpen。
构造函数
成员 |
描述 |
---|---|
创建一个特性,该特性用于将命名空间或模块路径标记为在引用程序集时自动打开。 |
实例成员
成员 |
描述 |
---|---|
指示要在引用程序集时自动打开的命名空间或模块,或者打开的外层模块。 |
平台
Windows 8、Windows 7、Windows Server 2012、Windows Server 2008 R2
版本信息
F# 核心库版本
支持:2.0、4.0、可移植