public void DeserializeBinary()
        {
            // Type
            var @this = new Dictionary<string, string> {{"Fizz", "Buzz"}};
            string s = @this.SerializeBinary();

            // Examples
            var value = s.DeserializeBinary<Dictionary<string, string>>(); // return new Dictionary<string, string> {{"Fizz", "Buzz"}};

            // Unit Test
            Assert.AreEqual("Buzz", value["Fizz"]);

            var product = new Product();
            product.Name = "Apple";
            product.Expiry = new DateTime(2008, 12, 28);
            product.Sizes = new[] {"Small"};

            // Serialize
            string resultProduct = product.SerializeBinary();

            // Deserialize
            var product2 = resultProduct.DeserializeBinary<Product>();

            // Unit Test
            Assert.AreEqual("Apple", product2.Name);
            Assert.AreEqual(new DateTime(2008, 12, 28).Date, product2.Expiry.Date);
            Assert.AreEqual("Small", product2.Sizes[0]);
        }
        public void SerializeBinary()
        {
            // Type
            var @this = new Dictionary<string, string> {{"Fizz", "Buzz"}};

            // Examples
            string result = @this.SerializeBinary(); // Serialize the object into a string.

            // Unit Test
            using (var stream = new MemoryStream(Encoding.Default.GetBytes(result)))
            {
                var binaryRead = new BinaryFormatter();
                var dict = (Dictionary<string, string>) binaryRead.Deserialize(stream);
                Assert.IsTrue(dict.ContainsKey("Fizz"));
            }
        }