title: How can I learn my List<CloudEvent> size as MB or KB?
body: <p>I am using  CloudNative.CloudEvents nuget package from <a href="https://cloudevents.io/" rel="nofollow noreferrer">https://cloudevents.io/</a> for cloudevents issues.</p>
  <p>I am getting the below error in my extension for binary serializer by using SerializeToUtf8Bytes() method.</p>
  <blockquote>
  <p>Serialization and deserialization of 'System.Type' instances are not supported. Path: $.SpecVersion.IdAttribute.Type.ClrType.</p>
  </blockquote>
  <pre><code>  public static bool IsEventBatchReachedLimits&lt;T&gt;(this IEnumerable&lt;T&gt; list)
    {
       var options = new JsonSerializerOptions() { Encoder = JavaScriptEncoder.Create(UnicodeRanges.All) };
  
       var resultBytes = JsonSerializer.SerializeToUtf8Bytes(list, options);
       string[] sizes = { &quot;B&quot;, &quot;KB&quot;, &quot;MB&quot;, &quot;GB&quot;, &quot;TB&quot; };
          var len = Convert.ToDouble(resultBytes.Length);
          var order = 0;
          while (len &gt;= 1024D &amp;&amp; order &lt; sizes.Length - 1)
          {
             order++;
             len /= 1024;
          }
          return (sizes[order] == &quot;MB&quot; &amp;&amp; len &gt;= 1) ? true : false;
       
    }
  </code></pre>
  <p>Can you tell me the reason why I can not serialize List to utf8 Bytes ?</p>
  <p>Usage above extension: Type of cloudEvents list is List</p>
  <p><a href="https://i.stack.imgur.com/q1X6K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q1X6K.png" alt="enter image description here" /></a> :</p>
  <p>Actually,  my real question is How can I learn my list size as MB or KB?</p>