diff --git a/docs/csharp/how-to/concatenate-multiple-strings.md b/docs/csharp/how-to/concatenate-multiple-strings.md index dfc7c51c5358b..a9d2e1d9a5c40 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: @@ -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) diff --git a/docs/csharp/how-to/parse-strings-using-split.md b/docs/csharp/how-to/parse-strings-using-split.md index 07adb90003e07..72c31840f87d6 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) 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..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 @@ -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: @@ -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) 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..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 @@ -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 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: @@ -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) diff --git a/docs/standard/serialization/system-text-json/deserialization.md b/docs/standard/serialization/system-text-json/deserialization.md index 509084126dd13..20dd8146495a2 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 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. @@ -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 @@ -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: @@ -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) 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..a7d6f98e2bfe9 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** @@ -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)