This was added in .NET 1.1
This namespace represents a collection of attribute objects that control how the XmlSerializer serializes and deserializes an object.



link - learn.microsoft.com/en-us/dotnet/standard/serialization/examples-of-xml-serialization

Data is commonly sent and retrieved in an XML format but processing the XML directly is a nightmare
To make this transition easier you can convert from XML to an object.
Converting between XML and custom business objects is known as serialization and there is a namespace dedicated to this.

Classes - System.XML.Serialization.XMLSerializer
Lets you convert objects to XML and visa versa.
This class will also automatically create arrays when there are nested elements

  • converts object to a stream of bytes

  • to persist the state of an object to a storage medium so an exact copy can be recreated at a later stage

  • to send an object by value from one app domain to another

  • can be used to save objects to the clipboard

.NET provides an automate serilization mechanism by using Reflection
When an object is serialized, the name of the class, the assembly and all the data members are written to storage.

Serializing a Class

Public Class MyClass

Private MyField As Boolean
Private m_bMyFlag As Boolean

Public Sub New
   m_bMyFlag = False
End Sub

Public Property MyFlag() As Boolean
      Return m_bFlag
   End Get

   Set(ByVal value As Boolean)
      m_bMyFlag = value
   End Set
End Property

Public Class AnotherClass
End Class

End Class

Renaming Classes

Public class MyClass

Renaming Elements

public string myelement

Renaming Attributes

public boolean myattribute

<newclass newattribute="one"> 

Ignoring Properties

Public string myproperty

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext