
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
C# program to concat two or more Lists
Set three lists −
// three lists var list1 = new List<int>{3, 4}; var list2 = new List<int>{1, 2, 3}; var list3 = new List<int>{2, 5, 6};
Now, use the Concat mthod to concat the above lists −
var res1 = list1.Concat(list2); var res2 = res1.Concat(list3);
Here is the complete code −
Example
using System.Collections.Generic; using System.Linq; using System; public class Demo { public static void Main() { // three lists var list1 = new List<int>{3, 4}; var list2 = new List<int>{1, 2, 3}; var list3 = new List<int>{2, 5, 6}; // concat var res1 = list1.Concat(list2); var res2 = res1.Concat(list3); foreach(int i in res2) { Console.WriteLine(i); } } }
Output
3 4 1 2 3 2 5 6
- Related Articles
- C# program to find Union of two or more Lists
- C# program to find common values from two or more Lists
- Python program to find Union of two or more Lists?
- How to concat two or more columns with separator in Android sqlite?
- How to find the intersection between two or more lists in R?
- C# program to find Union of two or more Dictionaries\n
- How to join or concatenate two lists in C#?
- C# program to find Intersection of two lists
- C# program to list the difference between two lists
- C# program to find additional values in two lists
- C++ Program for GCD of more than two (or array) numbers?
- Java Program to Join Two Lists
- Java Program to Merge two lists
- Program to find median of two sorted lists in C++
- C++ Program for GCD 0.of more than two (or array) numbers?

Advertisements