Configuration.HasFile 属性

定义

获取一个值,该值指示此对象表示 Configuration 的资源是否存在文件。

public:
 property bool HasFile { bool get(); };
public bool HasFile { get; }
member this.HasFile : bool
Public ReadOnly Property HasFile As Boolean

属性值

true 如果存在配置文件,则为否则,为 false.

示例

下面的代码示例演示如何使用该 HasFile 属性。

bool hasFile = config.HasFile;
Console.WriteLine("Has file: {0}", hasFile.ToString());
Dim hasFile As Boolean = config.HasFile
Console.WriteLine("Has file: {0}", hasFile.ToString())

注解

当此HasFile对象表示的资源从 Web.config 文件中继承设置时,该true属性也会返回Configuration

当此HasFile对象表示特定于位置的配置时,该false属性将Configuration返回。

适用于