So I have a folder with only 2 text files, I am reading them and storing the value. This is what the code looks:
public static void UnionFiles()
{
var dinfo =
new DirectoryInfo(
@"\http");
var files = dinfo.GetFiles("*.txt");
int i = 1;
System.Collections.Generic.IEnumerable<String> _eValA, _eValB;
foreach (var file in files)
{
if (i == 1)
{
_eValA = File.ReadLines(file.Name);
++i;
}
else
{
_eValB = File.ReadLines(file.Name);
i = 1;
}
}
IEnumerable<String> union = _eValA.Union(_eValB);
File.WriteAllLines(@"\http\union.txt", union.Cast<String>());
}
But I get this error: Use of unassigned local variable '_eValB, _eValA'
How can I get past it.
Thanks.