

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Concat Method in C#
To concat lists in C#, ue the Concat method.
The following is the list −
var list1 = new List<int>{12, 40}; var list2 = new List<int>{98, 122, 199, 230};
Here is the Concat method −
var res = list1.Concat(list2);
The following is the example to work with Concat method −
Example
using System.Collections.Generic; using System.Linq; using System; public class Demo { public static void Main() { // two lists var list1 = new List<int>{12, 40}; var list2 = new List<int>{98, 122, 199, 230}; // concat var res = list1.Concat(list2); foreach(int i in res) { Console.WriteLine(i); } } }
Output
12 40 98 122 199 230
- Related Questions & Answers
- Java String concat() method
- IntStream concat() method in Java
- LongStream concat() method in Java
- DoubleStream concat() method in Java
- String Concatenation by concat() method.
- Java string concat() method vs "+" operator
- Ints concat() function in Java
- Concat a field in MySQL SELECT?
- C# String Concat with examples
- concat(), replace(), and trim() Strings in Java.
- Concat a string to SELECT * in MySQL?
- Difference between concat() and + operator in Java
- Getting last value in MySQL group concat?
- Java string concat() sample code examples.
- Use MySQL concat() and lower() effectively
Advertisements