-3

hi please help me

string [] s = new string []{1 , 2 , 3 };
string [] e = new string [] {1 , 2 ,4};

the output what I want are : 1 2 3 4

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939

1 Answers1

2

You are declaring a string[], however your values are int. You must either use string values or change the type of your array to int.

Union of IEnumerable is the function you're looking for and it does everything for you.

int [] s = new int [] {1, 2, 3}; 
int [] e = new int [] {1, 2, 4};

int[] union = s.Union(e).ToArray();
Dominik
  • 1,623
  • 11
  • 27