Linq flat file




















Sign in Email. Forgot your password? Search within: Articles Quick Answers Messages. Tagged as C. Stats Using LINQ to read delimited text files.

The Manoj Kumar Rate me:. Please Sign up or sign in to vote. Did you ever face a situation where you want to read a delimited file CSV or any similar format and want to filter the records on the basis of some conditions by checking some values against columns. For example, let's assume that Data. Copy Code. The Manoj Kumar.

Team Leader. However, more complex types of pattern matching can be performed with a regular expression. Create a C console application project, with using directives for the System.

Linq and System. IO namespaces. Skip to main content. Linq is much simpler. Add a comment. Active Oldest Votes. Improve this answer. Jon Skeet Jon Skeet 1. I don't think there's a better way out of the box.

James Curran James Curran Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.

Everything else is done via LINQ queries. ToList ; The final method of note is when you add a new quotation. This gets the correct ID, checks to see if the quotation text already exists, then saves the new quote inside a lock statement to prevent thread contention while writing the the quotes.

Finally, it reloads the Quotes so the newly added Quotation is present. The downloadable solution has a complete ASP. NET Web project that puts everything to use. You can search for quotes, and even add a quotation.

Only 2 requirements: 1 must be static, 2 adorn with [WebMethod ] attribute. I could also have used the new jQuery template feature to bind my table. It was fun putting this together. I think it shows that there is more than one way come up with a good quotation.



0コメント

  • 1000 / 1000