Example #1
0
 public void Serialize(ExplanationResult result, IFastJsonWriter writer)
 {
     writer.WriteStartArray();
     foreach (var(fragment, explanation) in result.Explanations)
     {
         writer.WriteStartObject();
         writer.WritePropertyName("code");
         using (var code = writer.OpenString()) {
             SerializeFragment(fragment, code);
         }
         writer.WriteProperty("name", explanation.Name);
         writer.WriteProperty("text", explanation.Text);
         writer.WriteProperty("link", explanation.Link);
         writer.WriteEndObject();
     }
     writer.WriteEndArray();
 }
Example #2
0
 public void Serialize(ExplanationResult result, IFastJsonWriter writer)
 {
     writer.WriteStartArray();
     #pragma warning disable CS8619 // https://github.com/dotnet/roslyn/issues/35131
     foreach (var(fragment, explanation) in result.Explanations)
     {
     #pragma warning restore CS8619
         writer.WriteStartObject();
         writer.WritePropertyName("code");
         using (var code = writer.OpenString()) {
             SerializeFragment(fragment, code);
         }
         writer.WriteProperty("name", explanation.Name);
         writer.WriteProperty("text", explanation.Text);
         writer.WriteProperty("link", explanation.Link);
         writer.WriteEndObject();
     }
     writer.WriteEndArray();
 }