Sponsored Post: What exactly is the CsvReader?
Csv Reader is an extremely fast and stable .Net class for stream based parsing of virtually any commonly found delimited data format, CSV files, tab delimited files, etc. It’s usable from C#, VB.Net, ASP.Net, or any other .Net language. It’s compatible with the 1.0 .Net framework, 1.1, 2.0, and even the .Net Compact Framework. The methods are designed for ease of use, while the inner architecture is designed purely for speed and efficiency. Parsing is done using the de facto standard CSV file specifications. It handles quoted fields, delimiters in the data, and even data that spans across multiple lines. This gives you the ability to open csv files, edit csv files, and save csv files all directly from code.
I downloaded the .NET Demo and had been impressed by its easy usage. Here is a screenshot of the demo:
You see the original CSV file on the top left side, the XML parsing on the top right side and a DataGrid attached to the CSV file on the bottom of the screen. The processing time is incredible fast as shown here:
CsvReader cleary wins with less than 5 seconds. The coding is really easy, let’s look at the code sample for the textbox and DataGrid of the screenshot above:
175 using (StreamReader reader = new StreamReader(“../../products.csv”))
177 this.textBox1.Text = reader.ReadToEnd();
180 using (CsvReader reader = new CsvReader(“../../products.csv”))
182 this.dataGrid1.DataSource = reader.ReadToEnd();
That’s all, it’s really that simple. With the included samples you can start using CsvReader immediately and implent it in existing applications in just a few seconds.
Bruce recently released CsvReader v2.0 which also enables you to insert data directly into SQL Server which is a great addition to the existing features.
Check out the CsvReader website, it’s the way to go for dealing with csv files. You get 25% off if you order it before November 24th!