Created
November 30, 2025 17:25
-
-
Save Attosius/2228e46bb5ab0b7c69c0824833004c3e to your computer and use it in GitHub Desktop.
ДЗ: Объединение в одну коллекцию
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace IJuniorTasks | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var listFirst = new List<string> { "1", "a", "s", "1" }; | |
| var listSecond = new List<string> { "a", "d", "d" }; | |
| var hashSet = new HashSet<string>(); | |
| foreach (var item in listFirst) | |
| { | |
| hashSet.Add(item); | |
| } | |
| foreach (var item in listSecond) | |
| { | |
| hashSet.Add(item); | |
| } | |
| var listResult = hashSet.ToList(); | |
| Console.WriteLine(string.Join(", ", listResult)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment