Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
Removing duplicate elements from an array? - bug-code.com Q&A

Removing duplicate elements from an array?

0 like 0 dislike
21 views
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 array z?Help pls:c
asked by | 21 views

1 Answer

0 like 0 dislike
R82n3Ex.png

ps List is essentially a dynamic array, in many cases it is more convenient. Distinct() returns an IEnumerable. if you need strictly an array on output, is also simple - var uniques = ls.Distinct().ToArray(); List IEnumerable and Array are mutually convertible in any combination. and for all there is an extension Distinct()
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.7k users

24,788 questions
46,220 answers
0 comments
12,722 users