/// <summary> /// Gets the element key for a specified configuration element when overridden in a derived class. /// </summary> /// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for.</param> /// <returns> /// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>. /// </returns> protected override object GetElementKey(ConfigurationElement element) { Contract.Assume(element != null); // this should be Contract.Requires in base class. TypeConfigurationElement <T> typedElement = (TypeConfigurationElement <T>)element; return((!string.IsNullOrEmpty(typedElement.TypeName) ? typedElement.TypeName : typedElement.XamlSource) ?? string.Empty); }
/// <summary> /// Gets the element key for a specified configuration element when overridden in a derived class. /// </summary> /// <param name="element">The <see cref="T:System.Configuration.ConfigurationElement"/> to return the key for.</param> /// <returns> /// An <see cref="T:System.Object"/> that acts as the key for the specified <see cref="T:System.Configuration.ConfigurationElement"/>. /// </returns> protected override object GetElementKey(ConfigurationElement element) { Requires.NotNull(element, "element"); TypeConfigurationElement <T> typedElement = (TypeConfigurationElement <T>)element; return((!string.IsNullOrEmpty(typedElement.TypeName) ? typedElement.TypeName : typedElement.XamlSource) ?? string.Empty); }