System.Xml [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.5000.0 2.0.0.0 4.0.0.0 To be added System.Attribute System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.ReturnValue | System.AttributeTargets.All)

The belongs to a family of attributes that controls how the serializes or deserializes an object. For a complete list of similar attributes, see Attributes That Control XML Serialization.

You can apply the to a class, structure, enumeration, or interface. You can also apply the attribute to the return value of an XML Web service method.

Every XML document must have a single root element that contains all the other elements. The allows you to control how the generates the root element by setting certain properties. For example, specify the name of the generated XML element by setting the property.

For more information about using attributes, see Extending Metadata Using Attributes.

You can use the word XmlRoot in your code instead of the longer .

Controls XML serialization of the attribute target as an XML root element.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added

  Initializes a new instance of the class.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added

  Initializes a new instance of the class and specifies the name of the XML root element.

  The name of the XML root element.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added: an object of type 'string'

  The following table lists the XSD simple data types with their .NET equivalents.

  For the XSD base64Binary and hexBinary data types, use an array of structures, and apply a with the property set to "base64Binary" or "hexBinary", as appropriate. For the XSD time and date data types, use the type and apply the with the set to "date" or "time".

  For every XSD type that is mapped to a string, apply the with its property set to the XSD type. However, this does not change the serialization format, only the schema for the member.

  The property is case-sensitive, so you must set it exactly to one of the XSD data types.

  Passing binary data as an XML element is more efficient than passing it as an XML attribute.

  For more information about XML data types, see the World Wide Web Consortium (www.w3.org) document named "XML Schema Part 2: Datatypes".

  XSD data type

  .NET data type

  anyURI

  base64Binary

  Array of objects

  boolean

  byte

  date

  dateTime

  decimal

  double

  ENTITY

  ENTITIES

  float

  gDay

  gMonth

  gMonthDay

  gYear

  gYearMonth

  hexBinary

  Array of objects

  ID

  IDREF

  IDREFS

  int

  integer

  language

  long

  Name

  NCName

  negativeInteger

  NMTOKEN

  NMTOKENS

  normalizedString

  nonNegativeInteger

  nonPositiveInteger

  NOTATION

  positiveInteger

  QName

  recurringDate

  duration

  string

  short

  time

  token

  unsignedByte

  unsignedInt

  unsignedLong

  unsignedShort

  Gets or sets the XSD data type of the XML root element.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added: an object of type 'string'

  Specify an if you want the name of the generated XML element to differ from the class name.

  Gets or sets the name of the XML element that is generated and recognized by the class's and methods, respectively.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean To be added: an object of type 'bool'

  The XML schema specification for structures allows an XML document to explicitly signal that an element's content is missing. Such an element contains the attribute xsi:nil set to true. For more information, see the http://www.w3.org/TR/xmlschema-1/ specification named .

  If the property is set to true, the xsi:nil attribute is generated as shown in the following 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" xsi:nil="true" />`

  If the property is false, an empty element is created as shown in the following code:

  `<?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" />`

  Gets or sets a value that indicates whether the must serialize a member that is set to null into the xsi:nil attribute set to true.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added: an object of type 'string'

  The property conforms to the World Wide Web Consortium (www.w3.org) specification named .

  To create prefixed namespaces in the XML document, create an object that contains all the prefix-namespace pairs. The namespace you set for each must be contained in the object. When the generates the document, it correctly prefixes the element name for each array item.

  Gets or sets the namespace for the XML root element.