Home
Manage Your Code
Snippet: Basis of a simple xml serializable class inc. a collection (C#)
Title: Basis of a simple xml serializable class inc. a collection Language: C#
Description: Basis of a simple xml serializable class inc. a collection Views: 341
Author: Als James Date Added: 11/11/2008
Copy Code  
1namespace Name.Space
2{
3    [Serializable]
4    [XmlRoot("RootName")]
5    public class SerializeSomething
6    {
7        private String x;
8
9        private List<x> listOfx;
10
11        public SerializeSomething()
12        {
13            listOfx = new List<x>();
14        }
15
16        [XmlArray(ElementName = "ListName")]
17        [XmlArrayItem(ElementName = "Item")]
18        public List<x> SomeList
19        {
20            get
21            {
22                return listOfx;
23            }
24        }
25
26        [XmlAttribute(AttributeName = "AttribInRoot")]
27        public String RootAttrib
28        {
29            get
30            {
31                //
32            }
33
34            set
35            {
36                //
37            }
38        }
39}