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.

範例

下列範例顯示如何擴充 SerializeElement 方法。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

適用於