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 --- .../examples/configuration/attributes/index.html | 472 +++++++++++++++++++++ 1 file changed, 472 insertions(+) create mode 100644 ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html (limited to 'ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html') diff --git a/ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html b/ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html new file mode 100644 index 0000000..a5e958f --- /dev/null +++ b/ThirdParty/CsvHelper-master/docs/examples/configuration/attributes/index.html @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + Attributes | CsvHelper + + + + + + + + + + + + + + + + +
+
+
+ + + +
+
+
+

Attributes

+

Most of the configuration done via class maps can also be done using attributes.

+
Data
+
Identifier,name,IsBool,Constant
+1,one,yes,a
+2,two,no,b
+
+
Example
+
void Main()
+{
+	using (var reader = new StreamReader("path\\to\\file.csv"))
+	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+	{
+		csv.GetRecords<Foo>().ToList().Dump();
+	}
+}
+
+[Delimiter(",")]
+[CultureInfo("")]  // Set CultureInfo to InvariantCulture
+public class Foo
+{
+	[Name("Identifier")]
+	public int Id { get; set; }
+	
+	[Index(1)]
+	public string Name { get; set; }
+	
+	[BooleanTrueValues("yes")]
+	[BooleanFalseValues("no")]
+	public bool IsBool { get; set; }
+	
+	[Constant("bar")]
+	public string Constant { get; set; }
+	
+	[Optional]
+	public string Optional { get; set; }
+	
+	[Ignore]
+	public string Ignored { get; set; }	
+}
+
+
+ +
+
+
+
+ +

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