Created
July 23, 2010 10:39
-
-
Save StevenMcD/487273 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<string> GetColumnHeadings() | |
{ | |
List<string> ColumnHeadings = new List<string>(); | |
StreamReader rawFile = new StreamReader(@"filePath"); | |
string stringFile = rawFile.ReadToEnd(); | |
//// | |
//// Split the rows into an array | |
//// | |
string[] rows = stringFile.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); | |
// | |
// Split the tab separated fields (comma separated split commented) | |
// | |
//string[] dr = rows[i].Split(new char[] {','}); | |
if (rows.Count() > 0) | |
{ | |
string[] dr = rows[0].Split(new char[] {'\t'}); | |
ColumnHeadings.AddRange(dr.Where(t => t != "")); | |
} | |
return ColumnHeadings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment