Hi,

In the below mentioned code,I'm trying to deserialize the given XML into an object graph of type Message.Find the code below...

Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
namespace TestXML
{
  public class Program
    {
        static void Main(string[] args)
        {
            string xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Message><Books><Book><Author>Jack</Author><State>CA</State><Code><ISBN>1111-2222</ISBN><Price>35</Price></Code></Book></Books><Books>	<Book><Author>Daniel</Author><State>IL</State><Code><ISBN>3333-5555</ISBN><Price>23</Price></Code></Book></Books></Message>";

            XmlSerializer ser = new XmlSerializer(typeof(Message));

            using (System.IO.StringReader reader = new System.IO.StringReader(xml))
            {
                Message msg = ser.Deserialize(reader) as Message;

            }

        }

        [Serializable()]
        public class Message
        {
            public Message()
            {

            }
           
            public Books[] Books;
        }

        [Serializable()]
        public class Books
        {
            public Books()
            {

            }

            public Book Book;
        }

        [Serializable()]
        public class Book
        {
            public Book()
            {

            }

            public Code Code;

        }

        [Serializable()]
        public class Code
        {
            public Code()
            {

            }
        }
    }
}
But after deserializing,the msg instance is not having any collection of Books....It just shows 0 dimension of books.Why is it happening so...??