Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# ClassMap

sealed class CSVFileDefinitionMap : CsvClassMap<CSVFileDefinition>
{
   public CSVFileDefinitionMap()
   {
      Map(m => m.FRM_ID).Name("FARM ID");
      Map(m => m.FRM_OWNER).Name("FARM OWNER ");
   }
}

class CSVFileDefinition
{
    public string FRM_ID { get; set; }
    public string FRM_OWNER { get; set; }
}

using (TextReader reader = File.OpenText(fileName)) {
    var csv = new CsvReader(reader);
    csv.Configuration.RegisterClassMap<CSVFileDefinitionMap>();
    while (csv.Read()) {
       var record = csv.GetRecord<CSVFileDefinition>();
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: C++ program obtein volume in windows 
Csharp :: add two large numbers 
Csharp :: call Textboxfor in cs 
Csharp :: how to preset an array c# 
Csharp :: c# i++ meaning 
Csharp :: unity check if swipe not tap 
Csharp :: Convert C# Class to xml wth xsd.exe 
Csharp :: c# creat pen 
Csharp :: Appending to an Existing CSV File with csvhelper 
Csharp :: instance vs initiate 
Csharp :: array hw exercise 
Csharp :: how to set the forgound color of listitems in c# 
Csharp :: unity dictionary foreach remove 
Csharp :: asp.net core mvc razor page call pagemodel actio 
Csharp :: windowsform mail sender app 
Csharp :: c# convert linq jValue to int 
Csharp :: asp.net stop page jumping to top on click 
Csharp :: c# words return first 20 items of array 
Csharp :: sterge element din coada c# 
Csharp :: C# Custom setter with parameter 
Csharp :: beard styles without mustache Intitle:work with me 
Csharp :: OOP inC# 
Csharp :: bubble sort recursive c# 
Csharp :: how to set an expiry date on a program 
Csharp :: how to make your player movr the way you are rotated in unity 
Csharp :: Package manager or PM cmd for dbcontext migration 
Csharp :: get higest number in MVC 
Csharp :: Convert any class to a keyvaluepair 
Csharp :: how to full screen login form using C# MVC 
Csharp :: sort number in dynamo 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =