public void TestXmlSerialisation() { SubBase sb = new SubBase() { ValueType = 42, ImmutableType = "Hello World" }; try { XmlSerializer s = new XmlSerializer(typeof(Base), new Type[] { typeof(SubBase) }); MemoryStream ms = new MemoryStream(); s.Serialize(ms, sb); ms.Seek(0, SeekOrigin.Begin); XmlSerializer s2 = new XmlSerializer(typeof(Base), new Type[] { typeof(SubBase) }); SubBase sb2 = (SubBase)s2.Deserialize(ms); Assert.AreEqual(sb.ImmutableType, sb2.ImmutableType); Assert.AreEqual(sb.ValueType, sb2.ValueType); } catch (Exception ex) { Assert.Fail(ex.Message); } }
static void Main(string[] args) { Base A = new Base("First"); SubBase B = A.Make(); Console.WriteLine(B.txt + "|" + B.symb); SubBase C = B.Make(); Console.WriteLine(C.txt + "|" + C.symb); Console.ReadKey(); }
static void Main(string[] args) { Base A = new Base(1234); Console.WriteLine(A[2]); SubBase B = new SubBase(1234, 4321); Console.WriteLine(B[0, 1] + " " + B[1, 1]); Console.WriteLine(B[1]); Console.ReadKey(); }
public void TestSetValue_SubType() { Property p = new Property("Test", typeof(Base)); SubBase b = new SubBase(); p.Value = b; Assert.AreEqual(b, p.Value); p = new Property("Test", typeof(ICollection <String>)); List <String> list = new List <String>(); p.Value = list; Assert.AreEqual(list, p.Value); }
static void Main(string[] args) { int[] numz = { 1, 2, 3, 4, 5, 6, 8, 9 }; char[] symbs = { 'a', 'b' }; Base A = new Base(numz); A[0] = 18; Console.WriteLine(A[0]); SubBase B = new SubBase(numz, symbs); B['H'] = 'I'; Console.WriteLine(B['a'] + " " + B['b']); int[] nums = B.length; Console.WriteLine(nums[0] + " " + nums[1]); Console.ReadKey(); }
static void Main(string[] args) { Base A = new Base("Hello!"); Console.WriteLine(A); A.TEXT = "Ohayo!"; Console.WriteLine(A.TEXT); Console.WriteLine(A); SubBase B = new SubBase("Arigato", "gozaimasu"); Console.WriteLine(B); Console.WriteLine(B.TEXT); B.TEXT = "Good boi"; Console.WriteLine(B.TEXT); Console.ReadKey(); }
static void Main(string[] args) { Base A = new Base(76); Console.WriteLine(A); A.set(1); Console.WriteLine(A); SubBase B = new SubBase(8, 'j'); Console.WriteLine(B); B.set(99, '!'); SubSubBase C = new SubSubBase(100, 'A', "Yo!"); Console.WriteLine(C); C.set(777, '+', "YOYOYOYOYOYO!"); Console.WriteLine(C); Console.ReadKey(); }
static void Main(string[] args) { Base A = new Base('h'); Console.WriteLine(A.symb); SubBase B = new SubBase('H', "Yoshi!"); Console.WriteLine(B.symb + " " + B.txt); SubSubBase C = new SubSubBase('F', "YOYOY", 52); Console.WriteLine(C.symb + " " + C.txt + " " + C.num); Base A2 = new Base(A); Console.WriteLine(A2.symb); SubBase B2 = new SubBase(B); Console.WriteLine(B2.symb + " " + B2.txt); SubSubBase C2 = new SubSubBase(C); Console.WriteLine(C2.symb + " " + C2.txt + " " + C2.num); Console.ReadKey(); }
public void TestClone() { SubBase b = new SubBase(); Assert.AreEqual(1, b.ValueType); Assert.AreEqual("Test", b.ImmutableType); Assert.IsNotNull(b.ComplexType); Assert.AreEqual(42, b.ComplexType.Value); b.ComplexType.Value = 999; Assert.AreEqual(999, b.ComplexType.Value); SubBase b2 = (SubBase)b.Clone(); b2.ComplexType.Value = 100; b2.ImmutableType = "Test2"; Assert.AreEqual(999, b.ComplexType.Value); Assert.AreEqual(100, b2.ComplexType.Value); Assert.AreNotEqual(b.ComplexType, b2.ComplexType); Assert.AreNotEqual(b, b2); Assert.AreNotEqual(b.ImmutableType, b2.ImmutableType); b.Get <bool>("something"); }
public override SubBase Make() { SubBase tmp = new SubBase(this.txt, this.symb); return(tmp); }
public virtual SubBase Make() { SubBase tmp = new SubBase("Default", 'A'); return(tmp); }
public SubBase(SubBase obj) { this.symb = obj.symb; this.txt = obj.txt; }