Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,870 questions

51,793 answers

573 users

How to concatenate (concat) arrays of int in C#

3 Answers

0 votes
using System;
using System.Linq;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr1 = { 1, 2, 3, 4 };
            int[] arr2 = { 23, 56, 98 };

            var arrays = arr1.Concat(arr2);

            foreach (int n in arrays)
            {
                Console.WriteLine(n);
            }
        }
    }
}

/*
run:
   
1
2
3
4
23
56
98
 
*/

 



answered Jan 16, 2017 by avibootz
0 votes
using System;
using System.Linq;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr1 = { 1, 2, 3, 4 };
            int[] arr2 = { 23, 56, 98 };
            int[] arr3 = { 100, 200, 300 };

            var arrays = (arr1.Concat(arr2)).Concat(arr3);

            foreach (int n in arrays)
            {
                Console.WriteLine(n);
            }
        }
    }
}

/*
run:
   
1
2
3
4
23
56
98
100
200
300
 
*/

 



answered Jan 16, 2017 by avibootz
0 votes
using System;
using System.Linq;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr1 = { 1, 2, 3, 4 };
            int[] arr2 = { 23, 56, 98 };
            int[] arr3 = { 100, 200, 300 };

            var arrays1 = (arr1.Concat(arr2)).Concat(arr3);
            var arrays2 = ((arr1.Concat(arr2)).Concat(arr3)).Concat(arrays1);

            foreach (int n in arrays2)
            {
                Console.WriteLine(n);
            }
        }
    }
}

/*
run:
   
1
2
3
4
23
56
98
100
200
300
1
2
3
4
23
56
98
100
200
300
 
*/

 



answered Jan 16, 2017 by avibootz

Related questions

1 answer 153 views
1 answer 116 views
116 views asked Aug 11, 2021 by avibootz
1 answer 136 views
2 answers 238 views
3 answers 240 views
1 answer 98 views
...