void ChangeFileData(List <KeyValuePair <string, StringValues> > dataList) { int lineCurrent = 0, column = 0; foreach (var data in dataList) { var sCoord = data.Key.Split(','); if (!int.TryParse(sCoord[0], out lineCurrent) || !int.TryParse(sCoord[1], out column)) { continue; } while (lineCurrent >= FileData.Count()) { FileData.Add("\t\t"); } string str = FileData[lineCurrent]; List <string> elements = str.Split('\t').ToList(); StringBuilder newStr = new StringBuilder(); while (column > elements.Count() - 1) { elements.Add(""); } for (int i = 0; i < elements.Count(); i++) { if (i != 0) { newStr.Append("\t"); } newStr.Append(i != column ? elements[i] : data.Value.ToString()); } FileData[lineCurrent] = newStr.ToString(); } }