-1

I'm trying to make a console app with two double type arrays, but i have a problem. How can i add two arrays into one, but without repeating same number (i have same number in two arrays)?

Thank you very much

Dren
  • 39
  • 1
  • 1
  • 6

1 Answers1

0

Use Union from Linq:

double[] a = new double[] { 1, 2, 3, 4 };
double[] b = new double[] { 3, 4, 5, 6 };

double[] arr = a.Union(b).ToArray();

Variable arr will now contain 1, 2, 3, 4, 5, 6.

Marcin Sucharski
  • 1,191
  • 9
  • 9