示例#1
0
        private static void TestSerialize(Stopwatch stopWatch, Stream buffer, SerializationContext serializationContext)
        {
            var target =
                new PhotoData
            {
                Id            = 123,
                Image         = Image,
                Rating        = Rating.Good,
                TakenDateTime = DateTimeOffset.Now,
                Title         = "Favorite"
            };

            target.Tags.Add("Example");
            target.Tags.Add("Foo");
            target.Tags.Add("Bar");

            var serializer = serializationContext.GetSerializer <PhotoData>();

            stopWatch.Restart();
            serializer.Pack(buffer, target);
            stopWatch.Stop();
        }
示例#2
0
		private static void TestSerialize( Stopwatch stopWatch, Stream buffer, SerializationContext serializationContext )
		{
			var target =
				new PhotoData
				{
					Id = 123,
					Image = Image,
					Rating = Rating.Good,
					TakenDateTime = DateTimeOffset.Now,
					Title = "Favorite"
				};
			target.Tags.Add( "Example" );
			target.Tags.Add( "Foo" );
			target.Tags.Add( "Bar" );

			var serializer = serializationContext.GetSerializer<PhotoData>();
			stopWatch.Restart();
			serializer.Pack( buffer, target );
			stopWatch.Stop();
		}