public void ParseLine(string line) { if (line.StartsWith("MNO")) { int elementId = ParseSectionAsInt(line, 1); // equal to parts[1] - element id int vehicleId = ParseSectionAsInt(line, 2); // equal to parts[2] - vehicle id int term = ParseSectionAsInt(line, 3); // equal to parts[3] - term int mileage = ParseSectionAsInt(line, 4); // equal to parts[4] - mileage decimal value = ParseSectionAsDecimal(line, 5); // equal to parts[5] - value var valueHolder = new ValueHolderAsStruct(elementId, vehicleId, term, mileage, value); } }
public void ParseLine(char[] line) { if (line[0] == 'M' && line[1] == 'N' && line[2] == 'O') { int elementId = ParseSectionAsInt(line, 1); // equal to parts[1] - element id int vehicleId = ParseSectionAsInt(line, 2); // equal to parts[2] - vehicle id int term = ParseSectionAsInt(line, 3); // equal to parts[3] - term int mileage = ParseSectionAsInt(line, 4); // equal to parts[4] - mileage decimal value = ParseSectionAsDecimal(line, 5); // equal to parts[5] - value var valueHolder = new ValueHolderAsStruct(elementId, vehicleId, term, mileage, value); //list.Add(valueHolder); } }
public void ParseLine(StringBuilder line) { if (line[0] == 'M' && line[1] == 'N' && line[2] == 'O') { var startIndex = 3; int elementId = ParseSectionAsInt(line, ref startIndex); // equal to parts[1] - element id int vehicleId = ParseSectionAsInt(line, ref startIndex); // equal to parts[2] - vehicle id int term = ParseSectionAsInt(line, ref startIndex); // equal to parts[3] - term int mileage = ParseSectionAsInt(line, ref startIndex); // equal to parts[4] - mileage decimal value = ParseSectionAsDecimal(line, ref startIndex); // equal to parts[5] - value var valueHolder = new ValueHolderAsStruct(elementId, vehicleId, term, mileage, value); //list.Add(valueHolder); } }