Home All Groups Group Topic Archive Search About

custom serialization..need help

Author
4 May 2007 2:01 PM
AVL
Hi,
I'm  new serialization concepts....I need some hwlp..
I've a class defined as follows

class CustomSerialization1
    {
        private string s;

        public string Test
        {
            get { return s; }
            set { s = value; }
        }

        private int i;

        public int Test1
        {
            get { return i; }
            set { i = value; }
        }
CustomSerialization1 obj = new CustomSerialization1();
    obj.Test = "vijaya,wajid,vani";
object.Test1 = 3;
    }

    if want the the output to be sth below after applying serializatiion

    <Task>
    <Test>
    <TestInnner>Vijaya</TestInnner>
    <TestInnner>wajid</TestInnner>
    <TestInnner>vani</TestInnner>
    </Test>
    <Test1>3</Test3>
    </Task>

Basically I want to control teh way inwhich my Test property will be
displayed during serialization and deserialization....


please help me out..just let me know if this is possible by any means...
either thru XmlSerialization or Custom Serialziation...

Author
4 May 2007 2:55 PM
sloan
See this blog entry:
9/21/2005
XmlSerialization with IDictionary and CollectionBase Objects
http://sholliday.spaces.live.com/blog/

It may or may not help.



You have ~some control over what items are named.  But less control over if
they appear as Element or Attribute based.

You might consider xml to xml transformation.






Show quote
"AVL" <A**@discussions.microsoft.com> wrote in message
news:3F290A57-92A9-480C-87EA-1878EA25C1BF@microsoft.com...
> Hi,
> I'm  new serialization concepts....I need some hwlp..
> I've a class defined as follows
>
> class CustomSerialization1
>     {
>         private string s;
>
>         public string Test
>         {
>             get { return s; }
>             set { s = value; }
>         }
>
>         private int i;
>
>         public int Test1
>         {
>             get { return i; }
>             set { i = value; }
>         }
>  CustomSerialization1 obj = new CustomSerialization1();
>     obj.Test = "vijaya,wajid,vani";
> object.Test1 = 3;
>     }
>
>     if want the the output to be sth below after applying serializatiion
>
>     <Task>
>     <Test>
>     <TestInnner>Vijaya</TestInnner>
>     <TestInnner>wajid</TestInnner>
>     <TestInnner>vani</TestInnner>
>     </Test>
>     <Test1>3</Test3>
>     </Task>
>
> Basically I want to control teh way inwhich my Test property will be
> displayed during serialization and deserialization....
>
>
> please help me out..just let me know if this is possible by any means...
> either thru XmlSerialization or Custom Serialziation...

AddThis Social Bookmark Button