Browse Source

Use defined struct, rather than anon class (#3777)

Ben Adams 7 years ago
parent
commit
70ce0af1c0

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/PlatformBenchmarks/BenchmarkApplication.Json.cs

@@ -31,7 +31,7 @@ namespace PlatformBenchmarks
 
 
             // Content-Length header
             // Content-Length header
             writer.Write(_headerContentLength);
             writer.Write(_headerContentLength);
-            var jsonPayload = JsonSerializer.SerializeUnsafe(new { message = "Hello, World!" });
+            var jsonPayload = JsonSerializer.SerializeUnsafe(new JsonMessage() { message = "Hello, World!" });
             writer.WriteNumeric((uint)jsonPayload.Count);
             writer.WriteNumeric((uint)jsonPayload.Count);
 
 
             // End of headers
             // End of headers

+ 10 - 0
frameworks/CSharp/aspnetcore-mono/PlatformBenchmarks/Data/JsonMessage.cs

@@ -0,0 +1,10 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace PlatformBenchmarks
+{
+    public struct JsonMessage
+    {
+        public string message { get; set; }
+    }
+}