Skip to content

Instantly share code, notes, and snippets.

@Attosius
Created November 30, 2025 17:25
Show Gist options
  • Select an option

  • Save Attosius/2228e46bb5ab0b7c69c0824833004c3e to your computer and use it in GitHub Desktop.

Select an option

Save Attosius/2228e46bb5ab0b7c69c0824833004c3e to your computer and use it in GitHub Desktop.
ДЗ: Объединение в одну коллекцию
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