ConfigurationElement.SerializeElement(XmlWriter, Boolean) ConfigurationElement.SerializeElement(XmlWriter, Boolean) ConfigurationElement.SerializeElement(XmlWriter, Boolean) ConfigurationElement.SerializeElement(XmlWriter, Boolean) Method

定义

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

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

参数

writer
XmlWriter XmlWriter XmlWriter XmlWriter

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

serializeCollectionKey
Boolean Boolean Boolean Boolean

如果只序列化集合键属性,则为 true;否则为 falsetrue to serialize only the collection key properties; otherwise, false.

返回

如果实际序列化所有数据,则为 true;否则为 falsetrue if any data was actually serialized; otherwise, false.

异常

当前特性被锁定在更高的配置级别。The current attribute is locked at a higher configuration level.

示例

下面的示例演示如何扩展 @no__t 0 方法。The following example shows how to extend the SerializeElement method.

protected override bool SerializeElement(
    System.Xml.XmlWriter writer, 
    bool serializeCollectionKey)
{
    bool ret = base.SerializeElement(writer, 
        serializeCollectionKey);
    // You can enter your custom processing code here.
    return ret;

}
Protected Overrides Function SerializeElement(ByVal writer _
    As System.Xml.XmlWriter, _
    ByVal serializeCollectionKey As Boolean) As Boolean

    Dim ret As Boolean = _
        MyBase.SerializeElement(writer, serializeCollectionKey)
    ' Enter your custom processing code here.
    Return ret
End Function 'SerializeElement

适用于