1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System; 6 using System.Runtime.Serialization; 7 using System.Xml; 8 9 namespace SerializationTestTypes 10 { 11 [DataContract] 12 public class Person1 13 { 14 public object address; 15 Person1(string variation)16 public Person1(string variation) 17 { 18 age = 10; 19 name = "Tintin"; 20 address = new Address("rd", "wa", 90012); 21 } 22 Person1()23 public Person1() 24 { 25 } 26 27 [DataMember] 28 public int age; 29 30 [DataMember] 31 public string name; 32 } 33 34 [DataContract] 35 public class Person2 : Person1 36 { 37 [DataMember] 38 public Guid Uid; 39 40 [DataMember] 41 public XmlQualifiedName[] XQAArray; 42 43 [DataMember] 44 public object anyData; 45 Person2()46 public Person2() 47 { 48 Uid = new Guid("ff816178-54df-2ea8-6511-cfeb4d14ab5a"); 49 XQAArray = new XmlQualifiedName[] { new XmlQualifiedName("Name1", "http://www.PlayForFun.com"), new XmlQualifiedName("Name2", "http://www.FunPlay.com") }; 50 anyData = new Kid(); 51 } 52 } 53 54 public class Kid : Person1 55 { 56 [DataMember] 57 public object FavoriteToy; 58 Kid()59 public Kid() 60 { 61 FavoriteToy = new Blocks("Orange"); 62 age = 3; 63 } 64 } 65 66 [DataContract] 67 public class Blocks 68 { Blocks(string s)69 public Blocks(string s) 70 { 71 color = s; 72 } 73 74 [DataMember] 75 public string color; 76 } 77 78 [DataContract] 79 public class Address 80 { Address()81 public Address() 82 { 83 } 84 Address(string c, string s, int z)85 public Address(string c, string s, int z) 86 { 87 City = c; 88 State = s; 89 ZipCode = z; 90 } 91 92 [DataMember] 93 public string City; 94 95 [DataMember] 96 public string State; 97 98 [DataMember] 99 public int ZipCode; 100 } 101 } 102