Beispiel #1
0
        public void SerializeSelfReferencingTypes()
        {
            FileStream          FS  = new FileStream("Test.bin", FileMode.Create);
            CompactFormatter    CS  = new CompactFormatter();
            SelfReferencingItem SRI = new SelfReferencingItem(12);

            try
            {
                CS.Serialize(FS, SRI);
            }
            finally
            { FS.Close(); }
            FileStream FS2 = new FileStream("Test.bin", FileMode.Open);

            try
            {
                SelfReferencingItem SRI2 = (SelfReferencingItem)CS.Deserialize(FS2);
                FS2.Close();
                NUnit.Framework.Assertion.AssertEquals(SRI, SRI2);
            }
            finally
            {
                FS2.Close();
            }
        }
Beispiel #2
0
 public SelfReferencingItem(int seed)
 {
     me        = this;
     this.seed = seed;
 }
Beispiel #3
0
 /// <summary>
 /// Parameterless constructor requested by CompactFormatter
 /// </summary>
 public SelfReferencingItem()
 {
     me        = this;
     this.seed = 0;
 }