From e0a29eaab184cefa283c7ffee592c0d9ea0b327c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E6=A8=B9=E6=A1=9C=E4=B9=83?= Date: Fri, 2 May 2025 04:18:36 +0800 Subject: [PATCH] Correct the wrong example about JSON source generator in the readme --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 80c566990..15609dd91 100644 --- a/README.md +++ b/README.md @@ -501,13 +501,9 @@ public class Foo To apply the benefits of the new [JSON source generator](https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/) for System.Text.Json added in .NET 6, you can use `SystemTextJsonContentSerializer` with a custom instance of `RefitSettings` and `JsonSerializerOptions`: ```csharp -var options = new JsonSerializerOptions() { - TypeInfoResolver = MyJsonSerializerContext.Default -}; - var gitHubApi = RestService.For("https://api.github.com", new RefitSettings { - ContentSerializer = new SystemTextJsonContentSerializer(options) + ContentSerializer = new SystemTextJsonContentSerializer(MyJsonSerializerContext.Default.Options) }); ```