Only keep column names in SaneTsvRecord
We don't need to reference the parent
This commit is contained in:
parent
221f4eeff5
commit
0b7a920096
12
SaneTsv.cs
12
SaneTsv.cs
|
@ -238,7 +238,7 @@ public class SaneTsv
|
||||||
comment = currentComment.ToString();
|
comment = currentComment.ToString();
|
||||||
currentComment.Clear();
|
currentComment.Clear();
|
||||||
}
|
}
|
||||||
parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment, line));
|
parsed.Records.Add(new SaneTsvRecord(parsed.ColumnNames, ParseCurrentRecord(parsed, fields, line), comment, line));
|
||||||
fields.Clear();
|
fields.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public class SaneTsv
|
||||||
comment = currentComment.ToString();
|
comment = currentComment.ToString();
|
||||||
currentComment.Clear();
|
currentComment.Clear();
|
||||||
}
|
}
|
||||||
parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment, line));
|
parsed.Records.Add(new SaneTsvRecord(parsed.ColumnNames, ParseCurrentRecord(parsed, fields, line), comment, line));
|
||||||
fields.Clear();
|
fields.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,18 +925,18 @@ public class SaneTsv
|
||||||
|
|
||||||
public class SaneTsvRecord
|
public class SaneTsvRecord
|
||||||
{
|
{
|
||||||
public SaneTsv Parent { get; }
|
public string[] ColumnNames { get; }
|
||||||
public string Comment { get; }
|
public string Comment { get; }
|
||||||
public object[] Fields { get; }
|
public object[] Fields { get; }
|
||||||
public int Line { get; }
|
public int Line { get; }
|
||||||
|
|
||||||
public object this[string columnName] => Fields[Array.IndexOf(Parent.ColumnNames, columnName)];
|
public object this[string columnName] => Fields[Array.IndexOf(ColumnNames, columnName)];
|
||||||
|
|
||||||
public object this[int columnIndex] => Fields[columnIndex];
|
public object this[int columnIndex] => Fields[columnIndex];
|
||||||
|
|
||||||
public SaneTsvRecord(SaneTsv parent, object[] fields, string comment, int line)
|
public SaneTsvRecord(string[] columnNames, object[] fields, string comment, int line)
|
||||||
{
|
{
|
||||||
Parent = parent;
|
ColumnNames = columnNames;
|
||||||
Fields = fields;
|
Fields = fields;
|
||||||
Comment = comment;
|
Comment = comment;
|
||||||
Line = line;
|
Line = line;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user