예제 #1
0
파일: Remoting.cs 프로젝트: cash2one/HBNews
        public void TestDeSerNullItem()
        {
            BrokenDeserEntity obj = new BrokenDeserEntity {
                Value = 12345
            };

            using (MemoryStream ms = new MemoryStream())
            {
                BinaryFormatter bf = new BinaryFormatter();
                bf.Serialize(ms, obj);
                ms.Position = 0;
                try
                {
                    BrokenDeserEntity clone = (BrokenDeserEntity)bf.Deserialize(ms);
                }
                catch (TargetInvocationException ex)
                {
                    if (ex.InnerException == null)
                    {
                        throw;
                    }
                    throw ex.InnerException;
                }
            }
        }
예제 #2
0
 public void TestDeSerNullItem()
 {
     BrokenDeserEntity obj = new BrokenDeserEntity { Value = 12345 };
     using (MemoryStream ms = new MemoryStream())
     {
         BinaryFormatter bf = new BinaryFormatter();
         bf.Serialize(ms, obj);
         ms.Position = 0;
         try
         {
             BrokenDeserEntity clone = (BrokenDeserEntity)bf.Deserialize(ms);
         }
         catch (TargetInvocationException ex)
         {
             if (ex.InnerException == null) throw;
             throw ex.InnerException;
         }
     }
 }