×××标识处是我不懂的地方。
SearchEngine.cs
using System;
using System.Configuration;
/// <summary>
/// Summary description for SearchEngine
/// </summary>
public class SearchEngine : ConfigurationElement
{
// <configSections>
// <!-- Configuration section-handler declaration area. -->
// <sectionGroup name= "ddnTest ">
// <section name= "searchEngines " type= "SearchEnginesSection " />
// </sectionGroup>
// <!-- Other <section> and <sectionGroup> elements. -->
// </configSections>
// <ddnTest>
// <searchEngines defaultEngine= "baidu " defaultEngineUrl= "http://www.baidu.com " >
// <engine name= "baidu " url= "http://www.baidu.com " />
// Fields
private static ConfigurationPropertyCollection _properties = new ConfigurationPropertyCollection();
private static readonly ConfigurationProperty _propName = new ConfigurationProperty( "name ", typeof(string), " ", ConfigurationPropertyOptions.IsKey | ConfigurationPropertyOptions.IsRequired);
private static readonly ConfigurationProperty _propUrl = new ConfigurationProperty( "url ", typeof(string), " ", ConfigurationPropertyOptions.IsRequired);
// Methods
static SearchEngine()
{
_properties.Add(_propName);
_properties.Add(_propUrl);
}
public SearchEngine()
{
}
public SearchEngine(string name, string url) : this()
{
this.Name = name;
this.Url = url;
}
public override bool Equals(object searchEngine)
{
SearchEngine engine = searchEngine as SearchEngine;
if ((engine != null) && (engine.Name == this.Name))
{
return (engine.Url == this.Url);