static public List <ThingTotal> DataThing() { List <ThingTotal> result = new List <ThingTotal>(); var fname = "Thing.txt"; if (File.Exists(fname)) { foreach (var text in File.ReadLines(fname)) { var y = text.Split(','); ThingNameList.Add(y[0]); ThingNameList.Add(y[2]); ThingNameList.Add(y[4]); ThingNameList.Add(y[6]); ThingNameList.Add(y[8]); var x = new ThingTotal { AtomPen = Convert.ToDecimal(y[1]), Pen = Convert.ToDecimal(y[3]), Eraser = Convert.ToDecimal(y[5]), Ruler = Convert.ToDecimal(y[7]), LiWhite = Convert.ToDecimal(y[9]) }; result.Add(x); } } return(result); }
static public List <ThingTotal> DecimalThing(List <decimal> list) { List <ThingTotal> ThingDecimal = new List <ThingTotal>(); var t = new ThingTotal { AtomPen = list[0], Pen = list[1], Eraser = list[2], Ruler = list[3], LiWhite = list[4] }; ThingDecimal.Add(t); return(ThingDecimal); }