Jak stworzyć zmienna tmp by po wpisaniu do niej tmp = col[0]; byla wykrywana w if (tmp !=null)?
probowalem nawet zapisac ja jakos static ale caly czas widac ja jako null
File.Copy(saveFileDialog1.FileName, tempFileName, true);
using (var streamReader = new StreamReader(tempFileName))
using (var streamWriter = new StreamWriter(saveFileDialog1.FileName))
{
string line;
int count = 1;
while ((line = streamReader.ReadLine()) != null)
{
if (count > 1)
{
string[] col = line.Split(new char[] { '\t' });
if (line.StartsWith("ABC"))
{
if (tmp !=null)
{
if (!string.IsNullOrWhiteSpace(col[3]))
{
line = line.Replace(col[3], col3] + " " + tmp);
streamWriter.WriteLine(line);
tmp = null;
}
else
{
col[34] = tmp;
line = String.Join("\t", col);
streamWriter.WriteLine(line);
tmp = null;
}
}
else
{
streamWriter.WriteLine(line);
}
}
else
{
tmp = col[0];
streamWriter.WriteLine("");
count--;
}
}
else
{
//headers
streamWriter.WriteLine(line);
}
count++;
}
}