ConfigurationElement.Equals Method (System.Configuration)

Switch View :
ScriptFree
.NET Framework Class Library
ConfigurationElement.Equals Method

This member overrides Object.Equals(Object), and more complete documentation might be available in that topic.

Compares the current ConfigurationElement instance to the specified object.

Namespace:  System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)
Syntax

Visual Basic
Public Overrides Function Equals ( _
	compareTo As Object _
) As Boolean
C#
public override bool Equals(
	Object compareTo
)
Visual C++
public:
virtual bool Equals(
	Object^ compareTo
) override
F#
abstract Equals : 
        compareTo:Object -> bool 
override Equals : 
        compareTo:Object -> bool 

Parameters

compareTo
Type: System.Object
The object to compare with.

Return Value

Type: System.Boolean
true if the object to compare with is equal to the current ConfigurationElement instance; otherwise, false. The default is false.
Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Reference

Community Content

Orange Stripes
ConfigurationSection.Equals() returns inconsistent results

When a implementing a configuration class which derives from ConfigurationSection, all ConfigurationElement derived properties must be accessed in the constructor for the Equals() method to work consistently. A bug was filed, but has been flagged as won't fix.

https://connect.microsoft.com/VisualStudio/feedback/details/587629/configurationsection-equals-returns-inconsistent-results

public class TestConfigurationSection : ConfigurationSection
{
public TestConfigurationSection()
{
// Access all ConfigurationElement derived properties here
TestConfigurationElement element = Web;
}

[ConfigurationProperty("web", IsRequired = true)]
public TestConfigurationElement Web
{
get
{
return (TestConfigurationElement)this["web"];
}
}
}

public class TestConfigurationElement : ConfigurationElement
{
[ConfigurationProperty("url", DefaultValue = "", IsRequired = true)]
public string Url
{
get
{
return (string)this["url"];
}
set
{
this["url"] = value;
}
}
}