Created
January 26, 2015 03:16
-
-
Save Mooophy/3b1dc33ed49b9d6609e6 to your computer and use it in GitHub Desktop.
example for how to parse csv file in c#, tested.
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using Microsoft.VisualBasic.FileIO; | |
| namespace JuestForCshap | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| TextFieldParser parser = new TextFieldParser(@"d:\test.csv"); | |
| parser.TextFieldType = FieldType.Delimited; | |
| parser.SetDelimiters(","); | |
| while (!parser.EndOfData) | |
| foreach (var filed in parser.ReadFields()) | |
| Console.WriteLine(filed); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment