@@ -54,31 +54,28 @@ public class Foo(ICsvCoreReader csvCoreReader)
54
54
}
55
55
```
56
56
57
- In case you receive a csv that does not match the model you are reading the data too, then you can use the ` CsvPosition ` attribute in the model.
58
- Using the ` CsvPosition ` attribute you can specify the position of the property in the csv file.
57
+ In case you receive a csv that does not match the model you are reading the data too, then you can use the ` Header ` attribute in the model.
58
+ Using the ` Header ` attribute you can specify the position of the property in the csv file.
59
59
60
60
CSV file
61
61
``` text
62
62
Surname;Name;Birthdate;Email
63
63
Bar;Foo;01/01/2025;foo@bar.com
64
64
```
65
65
66
- Be aware that the position is zero based!
67
- The first column in the csv file is position 0, the second column is position 1 and so on.
68
-
69
66
``` csharp
70
67
public class NotMatchingPersonModel
71
68
{
72
- [CsvPosition ( 1 )] // This property is in the second column in the csv file.
69
+ [Header ( 2 )] // This property is in the second column in the csv file.
73
70
public string Name { get ; set ; }
74
71
75
- [CsvPosition ( 0 )] // This property is in the first column in the csv file.
72
+ [Header ( 1 )] // This property is in the first column in the csv file.
76
73
public string Surname { get ; set ; }
77
74
78
- [CsvPosition ( 2 )] // This property is in the third column in the csv file.
75
+ [Header ( 3 )] // This property is in the third column in the csv file.
79
76
public DateOnly BirthDate { get ; set ; }
80
77
81
- [CsvPosition ( 3 )] // This property is in the fourth column in the csv file.
78
+ [Header ( 4 )] // This property is in the fourth column in the csv file.
82
79
public string Email { get ; set ; }
83
80
}
84
81
```
0 commit comments