Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace array
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] stringSet1 = { "1", "2", "1" };
- string[] stringSet2 = { "4", "3", "2" };
- List<string> combinedCollection = new List<string>();
- AddSingleRecords(stringSet1, combinedCollection);
- AddSingleRecords(stringSet2, combinedCollection);
- ShowList(combinedCollection);
- }
- private static void AddSingleRecords(string[] stringSet, List<string> singlesList)
- {
- foreach (string element in stringSet)
- if (singlesList.Contains(element) == false)
- singlesList.Add(element);
- }
- private static void ShowList(List<string> collection)
- {
- foreach (string element in collection)
- Console.Write($"{element} ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement