Skip to content

Commit 01a262d

Browse files
authored
Revise AI section example (#50353)
* Revise AI section example Updated the date and improved the AI tools section with a clearer example prompt. * Change prompt to use string interpolation in C# example Updated example prompt to use string interpolation instead of String.Format.
1 parent 3b8933e commit 01a262d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

docs/csharp/how-to/concatenate-multiple-strings.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "How to concatenate multiple strings"
33
description: There are multiple ways to concatenate strings in C#. Learn the options and the reasons behind different choices.
4-
ms.date: 02/18/2025
4+
ms.date: 12/05/2025
55
helpviewer_keywords:
66
- "joining strings [C#]"
77
- "concatenating strings [C#]"
@@ -70,15 +70,21 @@ This option can cause more allocations than other methods for concatenating coll
7070

7171
## Use AI to concatenate strings
7272

73-
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.
73+
You can use AI tools, such as GitHub Copilot, to generate C# code to concatenate strings. You can customize the prompt to specify the output format, variables, and the method to use per your requirements.
7474

75-
The following text shows an example prompt for Copilot Chat:
75+
Here's an example Copilot Chat prompt:
7676

7777
```copilot-prompt
78-
Generate C# code to use String.Format to build an output string "Hi x, today's date is y. You are z years old." where x is "John", y is today's date and z is the birthdate January 1, 2000. The final string should show date in the full format mm/dd/yyyy. Show output.
78+
Generate C# code to use string interpolation to build an output string:
79+
"Hello [name], today's date is [current date]. You have [count] new notifications."
80+
Use variables for: name is "John", date is today's date, and notification count is 3.
81+
Format the date as mm/dd/yyyy.
82+
Show the output.
7983
```
8084

81-
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).
85+
Review Copilot's suggestions before applying them.
86+
87+
For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
8288

8389
## See also
8490

0 commit comments

Comments
 (0)