In the following condition: after a point it takes all the values to be '0'. Can anybody tell why it is happening?
var csv = new StringBuilder();
for (int i = 0; i <= terms.Length; i++)
{
if (terms[i] == firstlistA[i])
{
string first = terms[i];
string second = firstlistB[i];
var newLine = string.Format("{0},{1}{2}", first, second, Environment.NewLine);
csv.Append(newLine);
}
else
{
string first = terms[i];
string second = "0";
var newLine = string.Format("{0},{1}{2}", first, second, Environment.NewLine);
csv.Append(newLine);
}
File.WriteAllText(sfd.FileName, csv.ToString());