![]() ![]() That class will return a pre formatted list of values. I created a lamdba expression (LINQ) command that will pass each line of values to a static method in HRPRO class called FromCsv here. The File.ReadAllLines does the reading of values. So, since the source file could be one or more CSV files, I put it in an array of files then loop it. String path = Path.Combine(targetDir, csvnewfile + ".txt") String csvnewfile = csvfile.Substring(0, csvfile.IndexOf(".")) Ĭsvnewfile.Substring(csvnewfile.Length - 10, 10) String files = Directory.GetFiles(sourceDir) So first thing to do is to read the CSV files from a source directory.īelow code will read the source file and then write it to a List object. File class of System.IO namespace provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of FileStream objects. However I prefer to just use the File system of. Simple right? There are lots of ways or library to do the conversion. Recently I got a simple task of converting csv file format to a new text file format. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |