From 2a1cd4fda8a4a8e649910d16b4dfa1ce7ae63543 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 12 May 2023 09:24:40 +0800 Subject: *misc --- .../class-maps/auto-mapping/index.html | 462 +++++++++++++++++++++ 1 file changed, 462 insertions(+) create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html (limited to 'ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping') diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html new file mode 100644 index 0000000..e410ab5 --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/class-maps/auto-mapping/index.html @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + + + + + + + + + + Auto Mapping | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Auto Mapping

+

If you don't supply a map to the configuration, one is automatically created for you on the fly. You can call auto mapping directly in your class map also. You may want to do this if you have a large number of properties that will be set up correctly by default, and only need to make a couple changes.

+
Data
+
Id,The Name
+1,one
+
+
Example
+
void Main()
+{	   
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+    using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+    {
+        csv.Context.RegisterClassMap<FooMap>();
+        var records = csv.GetRecords<Foo>();
+    }
+}
+
+public class Foo
+{
+	public int Id { get; set; }
+	public string Name { get; set; }
+}
+
+public sealed class FooMap : ClassMap<Foo>
+{
+	public FooMap()
+	{
+		AutoMap(CultureInfo.InvariantCulture);
+		Map(m => m.Name).Name("The Name");
+	}
+}
+
+ +
+
+
+
+ +

+ + + + + + + + + + + -- cgit v1.1-26-g67d0