XML Serialization

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saquib189
    New Member
    • Aug 2008
    • 1

    XML Serialization

    Hi, I'm creating a simple project for xml serialization in the reference of Microsoft press MCTS .net 2.0 by Tony Northup. ok In this application I create a Class Shopping Cart That has 4 public members and a parameterless constructor because it mentioned that private and protected members are skipped during serialization. (is it true). and how can i put instance of the class in main method because the class contains parameterless constructor. i'll will show the example below:

    Code:
     Public Class ShoppingCartItem
           
            Public item As Integer
            Public Price As Double
            Public Rate As Integer
            Public total As Double
    
            Public Sub New()
                MyBase.New()
    
            End Sub
    
        End Class
    thank you
  • ravisankarblv
    New Member
    • Mar 2009
    • 2

    #2
    XML Serialization

    XmlSerializer class can only serialize the public properties of the class. Where as BinaryFormatter class can serialize private fields.
    We can create instance of a class where it contains parametreless constructor.
    It is similar like normal contructor class.

    Comment

    • PRR
      Recognized Expert Contributor
      • Dec 2007
      • 750

      #3
      For further info check MSDN
      and XmlSerializer

      Comment

      • plocker
        New Member
        • Mar 2009
        • 1

        #4
        Hello All,
        I am trying to convert the encoding format from UTF-16 to UTF-8 for an XML file.
        But I am not being able to change the format.

        Comment

        • MrMancunian
          Recognized Expert Contributor
          • Jul 2008
          • 569

          #5
          Originally posted by plocker
          Hello All,
          I am trying to convert the encoding format from UTF-16 to UTF-8 for an XML file.
          But I am not being able to change the format.
          I suggest that you open a new thread for your problem...

          Steven

          Comment

          Working...