我要从某个网站和文本“查看所有{将有一个数字}员工”中进行抓取。
现在,此数字由“,”分隔,如1200。所以归纳的正则表达式将是200或1,200或12,345,098。
public static void Main(string[] args)
{
var records = new List<Foo> { new Foo { Id = 1, Name = "" }, new Foo { Id = 2 } };
using (var csv = new CsvWriter(Console.Out))
{
var shouldIgnoreName = records.All(foo => string.IsNullOrEmpty(foo.Name));
var classMap = new DefaultClassMap<Foo>();
classMap.AutoMap();
classMap.Map(m => m.Name).Ignore(shouldIgnoreName);
csv.Configuration.RegisterClassMap(classMap);
csv.WriteRecords(records);
}
Console.ReadKey();
}
public class Foo
{
public int Id { get; set; }
public string Name { get; set; }
}