From 5cd4a85f5407f512fa252385fee198d9ddf5ad9d Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:51:02 -0700 Subject: [PATCH 01/33] Update how-to.md Modify per updated copilot highlights guidance --- docs/standard/serialization/system-text-json/how-to.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/standard/serialization/system-text-json/how-to.md b/docs/standard/serialization/system-text-json/how-to.md index da2e89cf13c50..fb7e17e005ef7 100644 --- a/docs/standard/serialization/system-text-json/how-to.md +++ b/docs/standard/serialization/system-text-json/how-to.md @@ -21,7 +21,7 @@ adobe-target: true This article shows how to use the namespace to serialize to JavaScript Object Notation (JSON). If you're porting existing code from `Newtonsoft.Json`, see [How to migrate to `System.Text.Json`](migrate-from-newtonsoft.md). > [!TIP] -> You can use AI assistance to [serialize to JSON with GitHub Copilot](#use-github-copilot-to-serialize-to-json). +> You can use [AI assistance to serialize to JSON](#use-AI-to-serialize-to-json). To write JSON to a string or to a file, call the method. @@ -108,9 +108,9 @@ Starting in .NET 9, you can also customize the indent character and size using < > [!TIP] > If you use `JsonSerializerOptions` repeatedly with the same options, don't create a new `JsonSerializerOptions` instance each time you use it. Reuse the same instance for every call. For more information, see [Reuse JsonSerializerOptions instances](configure-options.md#reuse-jsonserializeroptions-instances). -## Use GitHub Copilot to serialize to JSON +## Use AI to serialize to JSON -You can use GitHub Copilot in your IDE to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to use object fields that suit your requirements. +You can use AI tools, such as GitHub Copilot to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to use object fields that suit your requirements. The following text shows an example prompt for Copilot Chat: From 50e9de2f2e31b556afaf495191521ca5e2ff8930 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:55:43 -0700 Subject: [PATCH 02/33] Update migrate-from-newtonsoft.md --- .../system-text-json/migrate-from-newtonsoft.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md index 48c62c454d348..3ea4b3724458e 100644 --- a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md +++ b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md @@ -24,7 +24,7 @@ The `System.Text.Json` namespace provides functionality for serializing to and d * .NET Core 2.0, 2.1, and 2.2 > [!TIP] -> You can use AI assistance to [migrate from `Newtonsoft.Json`](#use-github-copilot-to-migrate). +> You can use AI assistance to [migrate from `Newtonsoft.Json`](#use-AI-to-migrate). `System.Text.Json` focuses primarily on performance, security, and standards compliance. It has some key differences in default behavior and doesn't aim to have feature parity with `Newtonsoft.Json`. For some scenarios, `System.Text.Json` currently has no built-in functionality, but there are recommended workarounds. For other scenarios, workarounds are impractical. @@ -630,9 +630,9 @@ System.Text.Json sets limits that can't be changed for some values, such as the Newtonsoft parses `NaN`, `Infinity`, and `-Infinity` JSON string tokens. With System.Text.Json, use . For information about how to use this setting, see [Allow or write numbers in quotes](invalid-json.md#allow-or-write-numbers-in-quotes). -## Use GitHub Copilot to migrate +## Use AI to migrate -You can get coding help from GitHub Copilot to migrate your code from `Newtonsoft.Json` to `System.Text.Json` within your IDE. You can customize the prompt per your requirements. +You can use AI tools, such as GitHub Copilot to migrate your code from `Newtonsoft.Json` to `System.Text.Json` within your IDE. You can customize the prompt per your requirements. **Example prompt for Copilot Chat** From 1ad831c1092f45b62a902861473e5d601039551d Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:56:34 -0700 Subject: [PATCH 03/33] Update how-to.md --- docs/standard/serialization/system-text-json/how-to.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/how-to.md b/docs/standard/serialization/system-text-json/how-to.md index fb7e17e005ef7..a0bf145eb2eed 100644 --- a/docs/standard/serialization/system-text-json/how-to.md +++ b/docs/standard/serialization/system-text-json/how-to.md @@ -21,7 +21,7 @@ adobe-target: true This article shows how to use the namespace to serialize to JavaScript Object Notation (JSON). If you're porting existing code from `Newtonsoft.Json`, see [How to migrate to `System.Text.Json`](migrate-from-newtonsoft.md). > [!TIP] -> You can use [AI assistance to serialize to JSON](#use-AI-to-serialize-to-json). +> You can use AI assistance to [serialize to JSON](#use-AI-to-serialize-to-json). To write JSON to a string or to a file, call the method. From 365db4cf5c63d8bfbd6d648a41769fd9145e467a Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:58:50 -0700 Subject: [PATCH 04/33] Update deserialization.md --- .../serialization/system-text-json/deserialization.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/standard/serialization/system-text-json/deserialization.md b/docs/standard/serialization/system-text-json/deserialization.md index 509084126dd13..e342859fb6065 100644 --- a/docs/standard/serialization/system-text-json/deserialization.md +++ b/docs/standard/serialization/system-text-json/deserialization.md @@ -22,7 +22,7 @@ This article shows how to use the method. For the generic overloads, the generic type parameter is the .NET class. For the non-generic overloads, you pass the type of the class as a method parameter. You can deserialize either synchronously or asynchronously. > [!TIP] -> You can use AI assistance to [deserialize a JSON string with GitHub Copilot](#use-github-copilot-to-deserialize-json). +> You can use AI assistance to [deserialize a JSON string](#use-AI-to-deserialize-json). Any JSON properties that aren't represented in your class are ignored [by default](missing-members.md). Also, if any properties on the type are [required](required-properties.md) but not present in the JSON payload, deserialization will fail. @@ -87,9 +87,9 @@ To deserialize from UTF-8, call a Date: Tue, 24 Jun 2025 15:00:20 -0700 Subject: [PATCH 05/33] Update customize-properties.md --- .../serialization/system-text-json/customize-properties.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/standard/serialization/system-text-json/customize-properties.md b/docs/standard/serialization/system-text-json/customize-properties.md index 9f7142829abe8..c7d3112a3814d 100644 --- a/docs/standard/serialization/system-text-json/customize-properties.md +++ b/docs/standard/serialization/system-text-json/customize-properties.md @@ -29,7 +29,7 @@ By default, property names and dictionary keys are unchanged in the JSON output, > The [web default](configure-options.md#web-defaults-for-jsonserializeroptions) naming policy is camel case. > [!TIP] -> You can use AI assistance to [create an object with custom serialization properties with GitHub Copilot](#use-github-copilot-to-customize-how-property-names-are-serialized). +> You can use AI assistance to [create an object with custom serialization properties](#use-AI-to-customize-how-property-names-are-serialized). For other scenarios that require special handling of JSON property names and values, you can [implement custom converters](converters-how-to.md). @@ -243,9 +243,9 @@ By default, properties are serialized in the order in which they're defined in t :::code language="csharp" source="snippets/how-to-6-0/csharp/PropertyOrder.cs"::: -## Use GitHub Copilot to customize how property names are serialized +## Use AI to customize how property names are serialized -You can prompt GitHub Copilot to apply patterns of changes to how your code serializes. +You can use AI tools, such as GitHub Copilot to apply patterns of changes to how your code serializes. Suppose your class declaration has properties that follow `PascalCasing`, and the JSON standard for your project is `snake_casing`. You can use AI to add the necessary [[JsonPropertyName]](xref:System.Text.Json.Serialization.JsonPropertyNameAttribute) attributes to every property in your class. You can use Copilot to make these changes with a chat prompt like this: From 000e39f7d1054cf2756e5345671dc49db8132df5 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:01:52 -0700 Subject: [PATCH 06/33] Update how-to-convert-a-string-to-a-number.md --- .../types/how-to-convert-a-string-to-a-number.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md index 336b05c76e705..660d6f8da99aa 100644 --- a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md +++ b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md @@ -21,7 +21,7 @@ It's slightly more efficient and straightforward to call a `TryParse` method (fo You use `Parse` or `TryParse` methods on the numeric type you expect the string contains, such as the type. The method uses internally. The `Parse` method returns the converted number; the `TryParse` method returns a boolean value that indicates whether the conversion succeeded, and returns the converted number in an `out` parameter. If the string isn't in a valid format, `Parse` throws an exception, but `TryParse` returns `false`. When calling a `Parse` method, you should always use exception handling to catch a when the parse operation fails. > [!TIP] -> You can use AI assistance to [convert a string to a number with GitHub Copilot](#use-github-copilot-to-convert-a-string-to-a-number). +> You can use AI assistance to [convert a string to a number](#use-AI-to-convert-a-string-to-a-number). ## Call Parse or TryParse methods @@ -55,9 +55,9 @@ The following example calls the Date: Tue, 24 Jun 2025 15:03:23 -0700 Subject: [PATCH 07/33] Update how-to-initialize-a-dictionary-with-a-collection-initializer.md --- ...initialize-a-dictionary-with-a-collection-initializer.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md index 4d3f1d471cccd..3888ec6399600 100644 --- a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md +++ b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md @@ -24,7 +24,7 @@ A contains a collection of key/ > while the second part of example, the public read / write indexer method, quietly overwrites the already existing entry with the same key. > [!TIP] -> You can use AI assistance to [initialize a dictionary with GitHub Copilot](#use-github-copilot-to-initialize-a-dictionary). +> You can use AI assistance to [initialize a dictionary](#use-AI-to-initialize-a-dictionary). ## Example @@ -34,9 +34,9 @@ In the following code example, a . Finally, the whole collection initializer for the dictionary is enclosed in braces. In the second initialization, the left side of the assignment is the key and the right side is the value, using an object initializer for `StudentName`. -## Use GitHub Copilot to initialize a dictionary +## Use AI to initialize a dictionary -You can use GitHub Copilot in your IDE to generate C# code to initialize a dictionary with a collection initializer. You can customize the prompt to add specifics per your requirements. +You can use AI tools, such as GitHub Copilot to generate C# code to initialize a dictionary with a collection initializer. You can customize the prompt to add specifics per your requirements. The following text shows an example prompt for Copilot Chat: From 6d4eb0f9c945da9c8b168c938b10c1269362d2f0 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:05:00 -0700 Subject: [PATCH 08/33] Update concatenate-multiple-strings.md --- docs/csharp/how-to/concatenate-multiple-strings.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csharp/how-to/concatenate-multiple-strings.md b/docs/csharp/how-to/concatenate-multiple-strings.md index dfc7c51c5358b..e5b35cd1d4b7a 100644 --- a/docs/csharp/how-to/concatenate-multiple-strings.md +++ b/docs/csharp/how-to/concatenate-multiple-strings.md @@ -15,7 +15,7 @@ ms.custom: copilot-scenario-highlight [!INCLUDE[interactive-note](~/includes/csharp-interactive-note.md)] > [!TIP] -> You can use AI assistance to [concatenate strings with GitHub Copilot](#use-github-copilot-to-concatenate-strings). +> You can use AI assistance to [concatenate strings](#use-AI-to-concatenate-strings). ## String literals @@ -70,9 +70,9 @@ combines an array of words, adding a space between each word in the array: This option can cause more allocations than other methods for concatenating collections, as it creates an intermediate string for each iteration. If optimizing performance is critical, consider the [`StringBuilder`](#stringbuilder) class or the [`String.Concat` or `String.Join`](#stringconcat-or-stringjoin) method to concatenate a collection, instead of `Enumerable.Aggregate`. -## Use GitHub Copilot to concatenate strings +## Use AI to concatenate strings -You can use GitHub Copilot in your IDE to generate C# code to concatenate multiple strings. You can customize the prompt to specify strings and the method to use per your requirements. +You can use AI tools, such as GitHub Copilot to generate C# code to concatenate multiple strings. You can customize the prompt to specify strings and the method to use per your requirements. The following text shows an example prompt for Copilot Chat: From 3e69412de8bd879df2400f26ef183ebed9bac67f Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:07:43 -0700 Subject: [PATCH 09/33] Update parse-strings-using-split.md --- docs/csharp/how-to/parse-strings-using-split.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/csharp/how-to/parse-strings-using-split.md b/docs/csharp/how-to/parse-strings-using-split.md index 07adb90003e07..e545c4be77189 100644 --- a/docs/csharp/how-to/parse-strings-using-split.md +++ b/docs/csharp/how-to/parse-strings-using-split.md @@ -16,7 +16,7 @@ The method creates an [!INCLUDE[interactive-note](~/includes/csharp-interactive-note.md)] > [!TIP] -> You can use AI assistance to [split a string with GitHub Copilot](#use-github-copilot-to-split-a-string). +> You can use AI assistance to [split a string](#use-AI-to-split-a-string). ## Split a string into words @@ -76,9 +76,9 @@ The following example shows the effect of trimming entries: The untrimmed entries have extra whitespace before the numerals. -## Use GitHub Copilot to split a string +## Use AI to split a string -You can use GitHub Copilot in your IDE to generate code to split strings using `String.Split` in C#. You can customize the prompt to use strings and delimiters per your requirements. +You can use AI tools, such as GitHub Copilot to generate code to split strings using `String.Split` in C#. You can customize the prompt to use strings and delimiters per your requirements. The following text shows an example prompt for Copilot Chat: @@ -90,10 +90,10 @@ Provide example output. GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). - ## See also - [Extract elements from a string](../../standard/base-types/divide-up-strings.md) - [Strings](../programming-guide/strings/index.md) - [.NET regular expressions](../../standard/base-types/regular-expressions.md) +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From 7f5b8dfa19be6de275b3625d3614d80f5bb9da3a Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:08:27 -0700 Subject: [PATCH 10/33] Update concatenate-multiple-strings.md --- docs/csharp/how-to/concatenate-multiple-strings.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/how-to/concatenate-multiple-strings.md b/docs/csharp/how-to/concatenate-multiple-strings.md index e5b35cd1d4b7a..ac9f78633f4e4 100644 --- a/docs/csharp/how-to/concatenate-multiple-strings.md +++ b/docs/csharp/how-to/concatenate-multiple-strings.md @@ -82,10 +82,10 @@ Generate C# code to use String.Format to build an output string "Hi x, today's d GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). - ## See also - - - [Strings](../programming-guide/strings/index.md) +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From ac4fc21d1e0e3a970cde7b2e29cabaccbd185953 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:09:14 -0700 Subject: [PATCH 11/33] Update how-to-initialize-a-dictionary-with-a-collection-initializer.md --- ...o-initialize-a-dictionary-with-a-collection-initializer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md index 3888ec6399600..1fcf618163cce 100644 --- a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md +++ b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md @@ -46,8 +46,8 @@ Generate C# code to initialize Dictionary using key-value pairs w GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). - ## See also - [Object and Collection Initializers](./object-and-collection-initializers.md) +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From 753bb6de7612e3c0a309cef81f555e2e5a459bfe Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:10:21 -0700 Subject: [PATCH 12/33] Update how-to-convert-a-string-to-a-number.md --- .../types/how-to-convert-a-string-to-a-number.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md index 660d6f8da99aa..59be77ead9c7e 100644 --- a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md +++ b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md @@ -67,4 +67,7 @@ Show me how to parse a string as a number, but don't throw an exception if the i GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). +## See also + +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From 29fd2f53f0768011c2a0231da194c0f43aeb2b05 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:11:23 -0700 Subject: [PATCH 13/33] Update customize-properties.md --- .../serialization/system-text-json/customize-properties.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/standard/serialization/system-text-json/customize-properties.md b/docs/standard/serialization/system-text-json/customize-properties.md index c7d3112a3814d..713d2b831de42 100644 --- a/docs/standard/serialization/system-text-json/customize-properties.md +++ b/docs/standard/serialization/system-text-json/customize-properties.md @@ -275,9 +275,9 @@ Use built-in serialization attributes. GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). - ## See also - [System.Text.Json overview](overview.md) - [How to serialize and deserialize JSON](how-to.md) +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From 711e5a9554470ef3d749b892805a1420efe767ec Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:12:03 -0700 Subject: [PATCH 14/33] Update deserialization.md --- .../serialization/system-text-json/deserialization.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/deserialization.md b/docs/standard/serialization/system-text-json/deserialization.md index e342859fb6065..47e493733bc8e 100644 --- a/docs/standard/serialization/system-text-json/deserialization.md +++ b/docs/standard/serialization/system-text-json/deserialization.md @@ -101,4 +101,7 @@ Provide example output. GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). +## See also + +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From e103dfaaf8099f8e9d08a8a5b97c86a42c186c41 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:12:40 -0700 Subject: [PATCH 15/33] Update migrate-from-newtonsoft.md --- .../serialization/system-text-json/migrate-from-newtonsoft.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md index 3ea4b3724458e..78012c5e60c68 100644 --- a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md +++ b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md @@ -651,9 +651,9 @@ Console.WriteLine(output); GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). - ## Additional resources * [System.Text.Json overview](overview.md) * [How to serialize and deserialize JSON](how-to.md) +* [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +* [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From 35862634ba8fcc4da83ce4e41143b1892d4380ab Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:13:20 -0700 Subject: [PATCH 16/33] Update how-to.md --- docs/standard/serialization/system-text-json/how-to.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/how-to.md b/docs/standard/serialization/system-text-json/how-to.md index a0bf145eb2eed..73061ced73c75 100644 --- a/docs/standard/serialization/system-text-json/how-to.md +++ b/docs/standard/serialization/system-text-json/how-to.md @@ -122,4 +122,7 @@ Provide example output. GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs). -Learn more about [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) and [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview). +## See also + +- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states) +- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview) From f564846fcf550562b5fb7fb0ff796ffdb82d6555 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:25:34 -0700 Subject: [PATCH 17/33] Update concatenate-multiple-strings.md --- docs/csharp/how-to/concatenate-multiple-strings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/how-to/concatenate-multiple-strings.md b/docs/csharp/how-to/concatenate-multiple-strings.md index ac9f78633f4e4..a772f582586cb 100644 --- a/docs/csharp/how-to/concatenate-multiple-strings.md +++ b/docs/csharp/how-to/concatenate-multiple-strings.md @@ -15,7 +15,7 @@ ms.custom: copilot-scenario-highlight [!INCLUDE[interactive-note](~/includes/csharp-interactive-note.md)] > [!TIP] -> You can use AI assistance to [concatenate strings](#use-AI-to-concatenate-strings). +> You can use AI assistance to [concatenate strings](#use-ai-to-concatenate-strings). ## String literals From 7af16ac4853b7bec80b869694d27a0c8781bd023 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:25:54 -0700 Subject: [PATCH 18/33] Update parse-strings-using-split.md --- docs/csharp/how-to/parse-strings-using-split.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/how-to/parse-strings-using-split.md b/docs/csharp/how-to/parse-strings-using-split.md index e545c4be77189..9ee915149c173 100644 --- a/docs/csharp/how-to/parse-strings-using-split.md +++ b/docs/csharp/how-to/parse-strings-using-split.md @@ -16,7 +16,7 @@ The method creates an [!INCLUDE[interactive-note](~/includes/csharp-interactive-note.md)] > [!TIP] -> You can use AI assistance to [split a string](#use-AI-to-split-a-string). +> You can use AI assistance to [split a string](#use-ai-to-split-a-string). ## Split a string into words From 70017b252aa535a3208449b1e060f0c47d7a3d25 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:26:04 -0700 Subject: [PATCH 19/33] Update how-to-initialize-a-dictionary-with-a-collection-initializer.md --- ...-to-initialize-a-dictionary-with-a-collection-initializer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md index 1fcf618163cce..02d07afb98ba1 100644 --- a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md +++ b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md @@ -24,7 +24,7 @@ A contains a collection of key/ > while the second part of example, the public read / write indexer method, quietly overwrites the already existing entry with the same key. > [!TIP] -> You can use AI assistance to [initialize a dictionary](#use-AI-to-initialize-a-dictionary). +> You can use AI assistance to [initialize a dictionary](#use-ai-to-initialize-a-dictionary). ## Example From afe32d173da7570d245eb46913e637bad2eec650 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:26:14 -0700 Subject: [PATCH 20/33] Update how-to-convert-a-string-to-a-number.md --- .../types/how-to-convert-a-string-to-a-number.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md index 59be77ead9c7e..4c4ce139645e2 100644 --- a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md +++ b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md @@ -21,7 +21,7 @@ It's slightly more efficient and straightforward to call a `TryParse` method (fo You use `Parse` or `TryParse` methods on the numeric type you expect the string contains, such as the type. The method uses internally. The `Parse` method returns the converted number; the `TryParse` method returns a boolean value that indicates whether the conversion succeeded, and returns the converted number in an `out` parameter. If the string isn't in a valid format, `Parse` throws an exception, but `TryParse` returns `false`. When calling a `Parse` method, you should always use exception handling to catch a when the parse operation fails. > [!TIP] -> You can use AI assistance to [convert a string to a number](#use-AI-to-convert-a-string-to-a-number). +> You can use AI assistance to [convert a string to a number](#use-ai-to-convert-a-string-to-a-number). ## Call Parse or TryParse methods From 5c8585241b025f493c6998951b601fa052c86448 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:26:34 -0700 Subject: [PATCH 21/33] Update customize-properties.md --- .../serialization/system-text-json/customize-properties.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/customize-properties.md b/docs/standard/serialization/system-text-json/customize-properties.md index 713d2b831de42..9d67978185abf 100644 --- a/docs/standard/serialization/system-text-json/customize-properties.md +++ b/docs/standard/serialization/system-text-json/customize-properties.md @@ -29,7 +29,7 @@ By default, property names and dictionary keys are unchanged in the JSON output, > The [web default](configure-options.md#web-defaults-for-jsonserializeroptions) naming policy is camel case. > [!TIP] -> You can use AI assistance to [create an object with custom serialization properties](#use-AI-to-customize-how-property-names-are-serialized). +> You can use AI assistance to [create an object with custom serialization properties](#use-ai-to-customize-how-property-names-are-serialized). For other scenarios that require special handling of JSON property names and values, you can [implement custom converters](converters-how-to.md). From 0a4d47410443c022c0ee25d30ae543ce9ef2cfff Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:26:44 -0700 Subject: [PATCH 22/33] Update deserialization.md --- docs/standard/serialization/system-text-json/deserialization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/deserialization.md b/docs/standard/serialization/system-text-json/deserialization.md index 47e493733bc8e..8ec13bb20eec3 100644 --- a/docs/standard/serialization/system-text-json/deserialization.md +++ b/docs/standard/serialization/system-text-json/deserialization.md @@ -22,7 +22,7 @@ This article shows how to use the method. For the generic overloads, the generic type parameter is the .NET class. For the non-generic overloads, you pass the type of the class as a method parameter. You can deserialize either synchronously or asynchronously. > [!TIP] -> You can use AI assistance to [deserialize a JSON string](#use-AI-to-deserialize-json). +> You can use AI assistance to [deserialize a JSON string](#use-ai-to-deserialize-json). Any JSON properties that aren't represented in your class are ignored [by default](missing-members.md). Also, if any properties on the type are [required](required-properties.md) but not present in the JSON payload, deserialization will fail. From a34a0e6af5ac7d2ac9b351b1accd4486353ffdcf Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:26:56 -0700 Subject: [PATCH 23/33] Update how-to.md --- docs/standard/serialization/system-text-json/how-to.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/how-to.md b/docs/standard/serialization/system-text-json/how-to.md index 73061ced73c75..5cb00d97db2cd 100644 --- a/docs/standard/serialization/system-text-json/how-to.md +++ b/docs/standard/serialization/system-text-json/how-to.md @@ -21,7 +21,7 @@ adobe-target: true This article shows how to use the namespace to serialize to JavaScript Object Notation (JSON). If you're porting existing code from `Newtonsoft.Json`, see [How to migrate to `System.Text.Json`](migrate-from-newtonsoft.md). > [!TIP] -> You can use AI assistance to [serialize to JSON](#use-AI-to-serialize-to-json). +> You can use AI assistance to [serialize to JSON](#use-ai-to-serialize-to-json). To write JSON to a string or to a file, call the method. From 5300a754f0a76f145ee8b2774f7ab28e3f30e6c3 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:27:12 -0700 Subject: [PATCH 24/33] Update migrate-from-newtonsoft.md --- .../serialization/system-text-json/migrate-from-newtonsoft.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md index 78012c5e60c68..50f8b398adb32 100644 --- a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md +++ b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md @@ -24,7 +24,7 @@ The `System.Text.Json` namespace provides functionality for serializing to and d * .NET Core 2.0, 2.1, and 2.2 > [!TIP] -> You can use AI assistance to [migrate from `Newtonsoft.Json`](#use-AI-to-migrate). +> You can use AI assistance to [migrate from `Newtonsoft.Json`](#use-ai-to-migrate). `System.Text.Json` focuses primarily on performance, security, and standards compliance. It has some key differences in default behavior and doesn't aim to have feature parity with `Newtonsoft.Json`. For some scenarios, `System.Text.Json` currently has no built-in functionality, but there are recommended workarounds. For other scenarios, workarounds are impractical. From ba3e1b0c2a45a997bb744bce319341417cf1e282 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Tue, 24 Jun 2025 15:42:35 -0700 Subject: [PATCH 25/33] Update how-to.md --- docs/standard/serialization/system-text-json/how-to.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/how-to.md b/docs/standard/serialization/system-text-json/how-to.md index 5cb00d97db2cd..12f002bd87f9b 100644 --- a/docs/standard/serialization/system-text-json/how-to.md +++ b/docs/standard/serialization/system-text-json/how-to.md @@ -49,7 +49,7 @@ The preceding examples use type inference for the type being serialized. An over :::code language="csharp" source="snippets/how-to/csharp/SerializeWithGenericParameter.cs" highlight="23"::: :::code language="vb" source="snippets/how-to/vb/RoundtripToString.vb" id="SerializeWithGenericParameter"::: -You can also use GitHub Copilot to generate serialization code for you. For instructions, see the [Use GitHub Copilot](#use-github-copilot-to-serialize-to-json) section in this article. +You can also use AI to generate serialization code for you. For instructions, see the [Use AI](#use-ai-to-serialize-to-json) section in this article. ## Serialization behavior From 767c2ceaffe230c98ffc873da4b3237963dc6361 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:49:57 -0700 Subject: [PATCH 26/33] Apply suggestion --- .../serialization/system-text-json/migrate-from-newtonsoft.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md index 50f8b398adb32..a7d6f98e2bfe9 100644 --- a/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md +++ b/docs/standard/serialization/system-text-json/migrate-from-newtonsoft.md @@ -632,7 +632,7 @@ Newtonsoft parses `NaN`, `Infinity`, and `-Infinity` JSON string tokens. With Sy ## Use AI to migrate -You can use AI tools, such as GitHub Copilot to migrate your code from `Newtonsoft.Json` to `System.Text.Json` within your IDE. You can customize the prompt per your requirements. +You can use AI tools, such as GitHub Copilot, to migrate your code from `Newtonsoft.Json` to `System.Text.Json` within your IDE. You can customize the prompt per your requirements. **Example prompt for Copilot Chat** From 39c756172a13194158f4bb34c4a3f3abbdf448d6 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:50:03 -0700 Subject: [PATCH 27/33] Apply suggestion --- docs/standard/serialization/system-text-json/how-to.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/how-to.md b/docs/standard/serialization/system-text-json/how-to.md index 12f002bd87f9b..babb9fb35a68d 100644 --- a/docs/standard/serialization/system-text-json/how-to.md +++ b/docs/standard/serialization/system-text-json/how-to.md @@ -110,7 +110,7 @@ Starting in .NET 9, you can also customize the indent character and size using < ## Use AI to serialize to JSON -You can use AI tools, such as GitHub Copilot to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to use object fields that suit your requirements. +You can use AI tools, such as GitHub Copilot, to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to use object fields that suit your requirements. The following text shows an example prompt for Copilot Chat: From 2a6880714863075dd031baa597201bc01bbd8932 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:50:08 -0700 Subject: [PATCH 28/33] Apply suggestion --- docs/standard/serialization/system-text-json/deserialization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/deserialization.md b/docs/standard/serialization/system-text-json/deserialization.md index 8ec13bb20eec3..20dd8146495a2 100644 --- a/docs/standard/serialization/system-text-json/deserialization.md +++ b/docs/standard/serialization/system-text-json/deserialization.md @@ -89,7 +89,7 @@ To deserialize from UTF-8, call a Date: Wed, 25 Jun 2025 09:50:13 -0700 Subject: [PATCH 29/33] Apply suggestion --- .../serialization/system-text-json/customize-properties.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/standard/serialization/system-text-json/customize-properties.md b/docs/standard/serialization/system-text-json/customize-properties.md index 9d67978185abf..71306e558d4c3 100644 --- a/docs/standard/serialization/system-text-json/customize-properties.md +++ b/docs/standard/serialization/system-text-json/customize-properties.md @@ -245,7 +245,7 @@ By default, properties are serialized in the order in which they're defined in t ## Use AI to customize how property names are serialized -You can use AI tools, such as GitHub Copilot to apply patterns of changes to how your code serializes. +You can use AI tools, such as GitHub Copilot, to apply patterns of changes to how your code serializes. Suppose your class declaration has properties that follow `PascalCasing`, and the JSON standard for your project is `snake_casing`. You can use AI to add the necessary [[JsonPropertyName]](xref:System.Text.Json.Serialization.JsonPropertyNameAttribute) attributes to every property in your class. You can use Copilot to make these changes with a chat prompt like this: From 01afd388caa15258016e832c9f1466ea30d9dec1 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:50:19 -0700 Subject: [PATCH 30/33] Apply suggestion --- .../types/how-to-convert-a-string-to-a-number.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md index 4c4ce139645e2..c577fcffee668 100644 --- a/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md +++ b/docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md @@ -57,7 +57,7 @@ The following example calls the Date: Wed, 25 Jun 2025 09:50:25 -0700 Subject: [PATCH 31/33] Apply suggestion --- ...-to-initialize-a-dictionary-with-a-collection-initializer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md index 02d07afb98ba1..5ea9e525947d6 100644 --- a/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md +++ b/docs/csharp/programming-guide/classes-and-structs/how-to-initialize-a-dictionary-with-a-collection-initializer.md @@ -36,7 +36,7 @@ Note the two pairs of braces in each element of the collection in the first decl ## Use AI to initialize a dictionary -You can use AI tools, such as GitHub Copilot to generate C# code to initialize a dictionary with a collection initializer. You can customize the prompt to add specifics per your requirements. +You can use AI tools, such as GitHub Copilot, to generate C# code to initialize a dictionary with a collection initializer. You can customize the prompt to add specifics per your requirements. The following text shows an example prompt for Copilot Chat: From 570f874761684adb33b85cdcf89d0dc3a7d26d0c Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:50:31 -0700 Subject: [PATCH 32/33] Apply suggestion --- docs/csharp/how-to/parse-strings-using-split.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/how-to/parse-strings-using-split.md b/docs/csharp/how-to/parse-strings-using-split.md index 9ee915149c173..72c31840f87d6 100644 --- a/docs/csharp/how-to/parse-strings-using-split.md +++ b/docs/csharp/how-to/parse-strings-using-split.md @@ -78,7 +78,7 @@ The untrimmed entries have extra whitespace before the numerals. ## Use AI to split a string -You can use AI tools, such as GitHub Copilot to generate code to split strings using `String.Split` in C#. You can customize the prompt to use strings and delimiters per your requirements. +You can use AI tools, such as GitHub Copilot, to generate code to split strings using `String.Split` in C#. You can customize the prompt to use strings and delimiters per your requirements. The following text shows an example prompt for Copilot Chat: From 3bbc39490e6eb169d38f1047c3a0e827a4e2e2c4 Mon Sep 17 00:00:00 2001 From: Megha Anand <88059806+anandmeg@users.noreply.github.com> Date: Wed, 25 Jun 2025 09:50:36 -0700 Subject: [PATCH 33/33] Apply suggestion --- docs/csharp/how-to/concatenate-multiple-strings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/csharp/how-to/concatenate-multiple-strings.md b/docs/csharp/how-to/concatenate-multiple-strings.md index a772f582586cb..a9d2e1d9a5c40 100644 --- a/docs/csharp/how-to/concatenate-multiple-strings.md +++ b/docs/csharp/how-to/concatenate-multiple-strings.md @@ -72,7 +72,7 @@ This option can cause more allocations than other methods for concatenating coll ## Use AI to concatenate strings -You can use AI tools, such as GitHub Copilot to generate C# code to concatenate multiple strings. You can customize the prompt to specify strings and the method to use per your requirements. +You can use AI tools, such as GitHub Copilot, to generate C# code to concatenate multiple strings. You can customize the prompt to specify strings and the method to use per your requirements. The following text shows an example prompt for Copilot Chat: