ConfigurationElement.SerializeToXmlElement(XmlWriter, String) 方法

定义

当在派生类中实现后,将此配置元素的外部标记写入配置文件。Writes the outer tags of this configuration element to the configuration file when implemented in a derived class.

protected:
 virtual bool SerializeToXmlElement(System::Xml::XmlWriter ^ writer, System::String ^ elementName);
protected public:
 virtual bool SerializeToXmlElement(System::Xml::XmlWriter ^ writer, System::String ^ elementName);
protected virtual bool SerializeToXmlElement (System.Xml.XmlWriter writer, string elementName);
protected internal virtual bool SerializeToXmlElement (System.Xml.XmlWriter writer, string elementName);
abstract member SerializeToXmlElement : System.Xml.XmlWriter * string -> bool
override this.SerializeToXmlElement : System.Xml.XmlWriter * string -> bool
Protected Overridable Function SerializeToXmlElement (writer As XmlWriter, elementName As String) As Boolean
Protected Friend Overridable Function SerializeToXmlElement (writer As XmlWriter, elementName As String) As Boolean

参数

writer
XmlWriter

写入配置文件的 XmlWriterThe XmlWriter that writes to the configuration file.

elementName
String

要写入的 ConfigurationElement 的名称。The name of the ConfigurationElement to be written.

返回

Boolean

如果写入成功,则为 true;否则为 falsetrue if writing was successful; otherwise, false.

例外

该元素包含多个子元素。The element has multiple child elements.

注解

在序列化期间调用 Unmerge 方法后,将调用 SerializeToXmlElement 方法。The SerializeToXmlElement method is called after the call to the Unmerge method during serialization. SerializeToXmlElement 方法写出元素的开始标记和结束标记之间的配置元素的内容。The SerializeToXmlElement method writes out the contents of the configuration element between the beginning and ending tags of the element. 重写 SerializeToXmlElement 以提供自定义序列化方法。Override SerializeToXmlElement to provide a custom serialization method.

适用于