ConfigurationElementCollection.GetElementKey(ConfigurationElement) 方法

定义

在派生类中重写时获取指定配置元素的元素键。Gets the element key for a specified configuration element when overridden in a derived class.

protected:
 abstract System::Object ^ GetElementKey(System::Configuration::ConfigurationElement ^ element);
protected abstract object GetElementKey (System.Configuration.ConfigurationElement element);
abstract member GetElementKey : System.Configuration.ConfigurationElement -> obj
Protected MustOverride Function GetElementKey (element As ConfigurationElement) As Object

参数

element
ConfigurationElement

要为其返回键的 ConfigurationElementThe ConfigurationElement to return the key for.

返回

一个 Object,用作指定 ConfigurationElement 的键。An Object that acts as the key for the specified ConfigurationElement.

示例

下面的代码示例演示如何重写 GetElementKey 方法。The following code example shows how to override GetElementKey method.

protected override Object GetElementKey(ConfigurationElement element)
{
    return ((UrlConfigElement)element).Name;
}
Protected Overrides Function GetElementKey(ByVal element As ConfigurationElement) As Object
    Return (CType(element, UrlConfigElement)).Name
End Function

适用于