0

in c#

I have two arrays a and b in class and i want to make a new array it have the elements of a and b without loup and in the define line like a and b like class cls { int[]a=new int[]{34,342,333,23}; int[]b= new int[]{322,232,3,32,43}; int[]c = // a + b }

31st Aug 2022, 1:15 PM
Mohammad al ayoubi
Mohammad al ayoubi - avatar
2 Answers
+ 1
Take a new array int c [] = new int[ a.Length + b.Length ]; Then copy values into 3rd array by loop.
31st Aug 2022, 1:18 PM
Jayakrishna 🇼🇳
+ 1
// Combine two arrays in C# var myList = new List<int>(); myList.AddRange(arr1); myList.AddRange(arr2); int[] arr3 = myList.ToArray(); https://www.tutorialspoint.com/combine-two-arrays-in-chash
31st Aug 2022, 3:35 PM
SoloProg
SoloProg - avatar