XmlAttributeEventHandler Delegate


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Represents the method that handles the UnknownAttribute

Namespace:   System.Xml.Serialization
Assembly:  System.Xml (in System.Xml.dll)

type XmlAttributeEventHandler = 
    delegate of 
        sender:Object *
        e:XmlAttributeEventArgs -> unit


Type: System.Object

The source of the event.

Type: System.Xml.Serialization.XmlAttributeEventArgs

An XmlAttributeEventArgs that contains the event data.

When you create an XmlAttributeEventHandler delegate, you identify the method that handles the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see NIB: Events and Delegates.

The UnknownAttribute event occurs only when an object is being deserialized with the Deserialize method.

The following example deserializes a class named Group from a file named UnknownAttributes.xml. Whenever an element is found in the file that has no corresponding member in the class, the UnknownAttribute event occurs. To try the example, paste the following XML code into a file named UnknownAttributes.xml.

<?xml version="1.0" encoding="utf-8"?>
<Group xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" GroupType = 'Technical' GroupNumber = '42' GroupBase = 'Red'>
No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top