本文整理汇总了C#中CsvReader.Load方法的典型用法代码示例。如果您正苦于以下问题:C# CsvReader.Load方法的具体用法?C# CsvReader.Load怎么用?C# CsvReader.Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvReader
的用法示例。
在下文中一共展示了CsvReader.Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadCountryInfo
private static CountryInfo[] ReadCountryInfo()
{
List<CountryInfo> countryInfoList = new List<CountryInfo>();
string country = String.Empty;
try
{
CsvReader reader = new CsvReader();
CsvLines lines = reader.Load(HttpContext.Current.Server.MapPath("~/country.info"));
foreach (CsvLine line in lines)
{
country = line.Fields[0];
CountryInfo ci = new CountryInfo(
line.Fields[0],
line.Fields[1],
line.Fields[2],
Convert.ToInt32(line.Fields[3]),
line.Fields[4],
line.Fields[5],
line.Fields[6],
line.Fields[7]);
countryInfoList.Add(ci);
}
}
catch (Exception ex)
{
string err = country + " " + ex.Message;
}
return countryInfoList.ToArray();
}
示例2: ReadLanguageInfo
private static LanguageInfo[] ReadLanguageInfo()
{
List<LanguageInfo> languageInfoList = new List<LanguageInfo>();
try
{
CsvReader reader = new CsvReader();
CsvLines lines = reader.Load(HttpContext.Current.Server.MapPath("~/language.info"));
foreach (CsvLine line in lines)
{
LanguageInfo li = new LanguageInfo(
line.Fields[0],
line.Fields[1],
line.Fields[2]);
languageInfoList.Add(li);
}
}
catch (Exception)
{
}
return languageInfoList.ToArray();
}