C# join

Join two strings:

string s1 = "csharp";
string s2 = "tutorial";
string s = s1 + s2; //csharptutorial

String.Join joins multiple strings into one:
using System;
string[] arr = {"this", "is", "good"};
string s = String.Join(" ",arr); //this is good

Join two Lists:
using System.Collections.Generic;
List lst = new List(200,300,400);
List lst2 = new List {4,9,18,3};
lst.AddRange(lst2);
lst.Concat(lst2);

Join two arrays:
int[] arr1 = new int[] {200,300};;
int[] arr2 = new int[] {3,4,2,1,5,8};
int[] arr = arr1.Concat(arr2);

Join two DataTables:
using System.Data;
dt.Merge(dt2);



endmemo.com © 2017  Terms of Use | Home