diff --git a/SaneTsv/SaneTsv.cs b/SaneTsv/SaneTsv.cs index f8c8f00..7de96a4 100644 --- a/SaneTsv/SaneTsv.cs +++ b/SaneTsv/SaneTsv.cs @@ -214,7 +214,7 @@ public class SaneTsv comment = currentComment.ToString(); currentComment.Clear(); } - parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment)); + parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment, line)); fields.Clear(); } @@ -271,7 +271,7 @@ public class SaneTsv comment = currentComment.ToString(); currentComment.Clear(); } - parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment)); + parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment, line)); fields.Clear(); } @@ -491,14 +491,18 @@ public class SaneTsv public SaneTsv Parent { get; } public string Comment { get; } public object[] Fields { get; } + public int Line { get; } public object this[string columnName] => Fields[Array.IndexOf(Parent.ColumnNames, columnName)]; - public SaneTsvRecord(SaneTsv parent, object[] fields, string comment) + public object this[int columnIndex] => Fields[columnIndex]; + + public SaneTsvRecord(SaneTsv parent, object[] fields, string comment, int line) { Parent = parent; Fields = fields; Comment = comment; + Line = line; } } }