ConfigurationElement.DeserializeElement(XmlReader, Boolean) 方法

定義

從組態檔讀取 XML。Reads XML from the configuration file.

protected public:
 virtual void DeserializeElement(System::Xml::XmlReader ^ reader, bool serializeCollectionKey);
protected internal virtual void DeserializeElement (System.Xml.XmlReader reader, bool serializeCollectionKey);
abstract member DeserializeElement : System.Xml.XmlReader * bool -> unit
override this.DeserializeElement : System.Xml.XmlReader * bool -> unit
Protected Friend Overridable Sub DeserializeElement (reader As XmlReader, serializeCollectionKey As Boolean)

參數

reader
XmlReader

從組態檔讀取的 XmlReaderThe XmlReader that reads from the configuration file.

serializeCollectionKey
Boolean

true 表示只針對集合主要屬性進行序列化,否則為 falsetrue to serialize only the collection key properties; otherwise, false.

例外狀況

要讀取的項目已經鎖定。The element to read is locked.

-或--or-

無法辨識目前節點的屬性 (Attribute)。An attribute of the current node is not recognized.

-或--or-

無法判斷目前節點的鎖定狀態。The lock status of the current node cannot be determined.

範例

下列範例示範如何擴充 DeserializeElement 方法。The following example demonstrates how to extend the DeserializeElement method.

protected override void DeserializeElement(
   System.Xml.XmlReader reader, 
    bool serializeCollectionKey)
{
    base.DeserializeElement(reader, 
        serializeCollectionKey);
    // You can your custom processing code here.
}
Protected Overrides Sub DeserializeElement(ByVal reader _
    As System.Xml.XmlReader, _
    ByVal serializeCollectionKey As Boolean)

    MyBase.DeserializeElement(reader, _
        serializeCollectionKey)
    ' Enter your custom processing code here.
End Sub

適用於