The following code does not want to compile. I am getting an error message:
The best overloaded method match for 'System.Collections.Generic.List.Add(string[])has some invalid arguments
But I cannot see what is wrong. Any suggestions?
public static List<string[]> ReadFromDelimitedFile (string Path)
{
int i=0;
List<string[]> AllContracts = new List<string[]>();
using (TextFieldParser parser = new TextFieldParser(Path))
{
parser.Delimiters = new string[] { "\t" };
while (true)
{
AllContracts.Add(i)= parser.ReadFields();
if (AllContracts.Add(i) == null)
{
break;
}
i++;
}
}
return AllContracts;
}
AllContracts[i]
?if (AllContracts.Add(i) == null)
will also cause a compiler error. Add returns void.