Skip to content

Instantly share code, notes, and snippets.

@Mooophy
Created January 26, 2015 03:16
Show Gist options
  • Select an option

  • Save Mooophy/3b1dc33ed49b9d6609e6 to your computer and use it in GitHub Desktop.

Select an option

Save Mooophy/3b1dc33ed49b9d6609e6 to your computer and use it in GitHub Desktop.
example for how to parse csv file in c#, tested.
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