This topic has not yet been rated - Rate this topic

Configuration.HasFile Property

Note: This property is new in the .NET Framework version 2.0.

Indicates whether a configuration file exists for the resource represented by this Configuration object.

Namespace: System.Configuration
Assembly: System.Configuration (in system.configuration.dll)

public bool HasFile { get; 
/** @property */
public boolean get_HasFile ()

public function get HasFile () : boolean

Property Value

true if there is a configuration file; otherwise, false.

The HasFile property also returns true when the resource represented by this Configuration object inherits settings from a Web.config file.

The HasFile property returns false when this Configuration object represents a location-specific configuration.

The following code example demonstrates how to use the HasFile property.

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

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.