コード例 #1
0
        public T DeserializeUnmarshall <T>(string text)
        {
            global::System.Text.Json.JsonSerializerOptions options = null;
            options = new global::System.Text.Json.JsonSerializerOptions
            {
                WriteIndented = true
            };
            T t = global::System.Text.Json.JsonSerializer.Deserialize <T>(text, options);

            return(t);
        }
コード例 #2
0
        public async Task <T> DeserializeUnmarshallAsync <T>(string text)
        {
            global::System.Text.Json.JsonSerializerOptions options = null;
            options = new global::System.Text.Json.JsonSerializerOptions
            {
                WriteIndented = true
            };

            T t = default(T);

            using
            (
                global::System.IO.MemoryStream ms
                    = new global::System.IO.MemoryStream
                      (
                          global::System.Text.Encoding.UTF8.GetBytes(text)
                      )
            )
            {
                t = await global::System.Text.Json.JsonSerializer.DeserializeAsync <T>(ms, options);
            }

            return(t);
        }
コード例 #3
0
 public override void Write(global::System.Text.Json.Utf8JsonWriter writer, SystemTextJsonPackageIdentifier value, global::System.Text.Json.JsonSerializerOptions options)
 {
     if (value is null)
     {
         throw new global::System.ArgumentNullException(nameof(value));
     }
     global::System.Text.Json.JsonSerializer.Serialize(writer, value._value, typeof(string), options);
 }
コード例 #4
0
 public Net60GeneratedContext(global::System.Text.Json.JsonSerializerOptions options) : base(options)
 {
 }
コード例 #5
0
            public override SystemTextJsonPackageIdentifier Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)
            {
                var value = global::System.Text.Json.JsonSerializer.Deserialize <string>(ref reader, options);

                return(new SystemTextJsonPackageIdentifier(value));
            }