本文整理汇总了C#中CsvReader.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# CsvReader.Skip方法的具体用法?C# CsvReader.Skip怎么用?C# CsvReader.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvReader
的用法示例。
在下文中一共展示了CsvReader.Skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindTagPeople
public ActionResult FindTagPeople(string text, string tagname)
{
if (!tagname.HasValue())
return Content("no tag");
var csv = new CsvReader(new StringReader(text), false, '\t').ToList();
if (!csv.Any())
return Content("no data");
var line0 = csv.First().ToList();
var names = line0.ToDictionary(i => i.TrimEnd(),
i => line0.FindIndex(s => s == i));
var ActiveNames = new List<string>
{
"First",
"Last",
"Birthday",
"Email",
"CellPhone",
"HomePhone",
};
var hasvalidcolumn = false;
foreach (var name in names.Keys)
if (ActiveNames.Contains(name))
{
hasvalidcolumn = true;
break;
}
if (!hasvalidcolumn)
return Content("no valid column");
var list = new List<FindInfo>();
foreach (var a in csv.Skip(1))
{
var row = new FindInfo();
row.First = FindColumn(names, a, "First");
row.Last = FindColumn(names, a, "Last");
row.Birthday = FindColumnDate(names, a, "Birthday");
row.Email = FindColumn(names, a, "Email");
row.CellPhone = FindColumnDigits(names, a, "CellPhone");
row.HomePhone = FindColumnDigits(names, a, "HomePhone");
var pids = DbUtil.Db.FindPerson3(row.First, row.Last, row.Birthday, row.Email, row.CellPhone, row.HomePhone, null);
row.Found = pids.Count();
if (row.Found == 1)
row.PeopleId = pids.Single().PeopleId.Value;
list.Add(row);
}
var q = from pi in list
where pi.PeopleId.HasValue
select pi.PeopleId;
foreach (var pid in q.Distinct())
Person.Tag(DbUtil.Db, pid.Value, tagname, Util.UserPeopleId, DbUtil.TagTypeId_Personal);
DbUtil.Db.SubmitChanges();
return View(list);
}