コード例 #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
ファイル: PerformanceTest.cs プロジェクト: gezidan/ZYSOCKET
		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();
		}