Code below will merge the multiple files into single file. This will work in C# 4.0 framework on wards. tempFiles is the string , holding the filepath+name of the files . Between each files a separator',' is present.
string[] split = tempFiles.Split(',');
string export_file = "MergedFiles.txt";
File.WriteAllLines(filePath + export_file, split.SelectMany(File.ReadLines));
Quick Notes for easy understanding. Chapters are on C#.Net,Linq,OOPS,Design Patterns,UML,Tools for development, Databases and many others. - Sid
Tuesday, August 20, 2013
Thursday, August 1, 2013
Logic to load the list with the series of excel columns (alphabetic).
Logic to load the list with the series of excel columns (alphabetic) by giving the number of columns is required.
Later this list can be useful for creating data column on DataTable.
for Example, if you want to create 30 columns , list will be filled with
A
B
C
D
E
.
.
.
AA
AB
AC
AD
static void Alpha(ref List<string> col, List<string> alp,int num)
{
string temp = "";
int set = 0;
int j = 1;
for(int i=0 ;i<num;i++)
{
col.Add(temp + alp[j-1]);
if (j % alp.Count == 0)
{
temp = col[set];
set++;
j = 0;
}
j++;
}
}
static void Main(string[] args)
{
List<string> alp = new List<string>() { "A","B","C","D","E","F","G","H","I","J","K","L",
"M","N","O","P","Q","R","S","T","U","V","W","X",
"Y","Z"};
List<string> columns = new List<string>();
int numOfCols = 30;
Alpha(ref columns, alp, numOfCols);
}
Subscribe to:
Posts (Atom)
Code Formater
Paste Here Your Source Code | ||||||||||||||
Source Code Formatting Options | ||||||||||||||
|
||||||||||||||
Copy Formatted Source Code | ||||||||||||||
Preview Of Formatted Code |