From 41bdc2264a77628755750cbd763b23fd68dfa677 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Tue, 23 Sep 2025 16:01:26 +0000 Subject: [PATCH] Remove section calling out using AI to initialize a dictionary --- ...dictionary-with-a-collection-initializer.md | 18 ------------------ 1 file changed, 18 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 5ea9e525947d6..5c3964c36d593 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 @@ -5,7 +5,6 @@ ms.date: 02/12/2025 helpviewer_keywords: - "collection initializers [C#], with Dictionary" ms.topic: how-to -ms.custom: copilot-scenario-highlight ms.assetid: 25283922-f8ee-40dc-a639-fac30804ec71 --- # How to initialize a dictionary with a collection initializer (C# Programming Guide) @@ -23,9 +22,6 @@ A contains a collection of key/ > method throws : `'An item with the same key has already been added. Key: 111'`, > 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). - ## Example In the following code example, a is initialized with instances of type `StudentName`. The first initialization uses the `Add` method with two arguments. The compiler generates a call to `Add` for each of the pairs of `int` keys and `StudentName` values. The second uses a public read / write indexer method of the `Dictionary` class: @@ -34,20 +30,6 @@ 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 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. - -The following text shows an example prompt for Copilot Chat: - -```copilot-prompt -Generate C# code to initialize Dictionary using key-value pairs within the collection initializer. The employee class is a record class with two properties: Name and Age. -``` - -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). - ## 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)