Answer the question
In order to leave comments, you need to log in
Removing duplicate elements from an array?
string[] a = Console.ReadLine().Split(' ');
string[] b = Console.ReadLine().Split(' ');
string[] z = new string[a.Length + b.Length];
a.CopyTo(z, 0);
b.CopyTo(z, a.Length);
How to remove duplicate elements from z array? Help pls:c
Answer the question
In order to leave comments, you need to log in
ps List is essentially a dynamic array, in many cases it is more convenient. Distinct() returns an IEnumerable. if you need a strictly array output, everything is also simple - var uniques = ls.Distinct().ToArray();
List, IEnumerable and Array are mutually convertible in any combination. and for all there is a Distinct() extension
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question