Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string[] numbers = { "1", "2", "3", "3", "1", "1", "5" };
- string[] numbers2 = { "6", "6", "3", "3", "1", "5", "5" };
- List<string> reworkedList = new List<string>();
- TryAddValuesToList(reworkedList, numbers);
- TryAddValuesToList(reworkedList, numbers2);
- foreach (string value in reworkedList)
- {
- Console.Write(value);
- }
- Console.ReadKey();
- }
- private static void TryAddValuesToList(List<string> finalValues, string[] sourceValues)
- {
- for (int i = 0; i < sourceValues.Length; i++)
- {
- bool isSameValuesFound = false;
- for (int j = 0; j < finalValues.Count; j++)
- {
- if (sourceValues[i] == finalValues[j])
- {
- isSameValuesFound = true;
- break;
- }
- }
- if (isSameValuesFound == false)
- {
- finalValues.Add(sourceValues[i]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement