From 6c723a3414ef6317916641080855003c8f46d6d5 Mon Sep 17 00:00:00 2001 From: trnq1ll0 Date: Tue, 4 Jun 2024 09:44:00 +0200 Subject: [PATCH] fix: error CS1061: 'ReadingContext' does not contain a definition for 'RegisterClassMap' and no accessible extension method 'RegisterClassMap' There is no function in the class Context so i searched for and find that it must be called "Configuration". The full error message in Unity: error CS1061: 'ReadingContext' does not contain a definition for 'RegisterClassMap' and no accessible extension method 'RegisterClassMap' accepting a first argument of type 'ReadingContext' could be found. --- .../configuration/class-maps/mapping-by-name/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/examples/configuration/class-maps/mapping-by-name/index.html b/docs/examples/configuration/class-maps/mapping-by-name/index.html index 519c08729..b1c4a1da5 100644 --- a/docs/examples/configuration/class-maps/mapping-by-name/index.html +++ b/docs/examples/configuration/class-maps/mapping-by-name/index.html @@ -412,10 +412,13 @@
Data
Example
void Main()
 {
+	using CsvHelper;
+	using CsvHelper.Configuration;
+	
 	using (var reader = new StreamReader("path\\to\\file.csv"))
 	using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
 	{
-		csv.Context.RegisterClassMap<FooMap>();
+		csv.Configuration.RegisterClassMap<FooMap>();
 		var records = csv.GetRecords<Foo>();
 	}
 }