The reference to the object is not set in the instance of the object when using the <T> list in C #
I have the following code snippet that creates a compilation error:
public List<string> batchaddresses; public MapFiles(string [] addresses) { for (int i = 0; i < addresses.Count(); i++) { batchaddresses.AddRange(Directory.GetFiles(addresses[i], "*.esy")); } } I get an error when trying to use the List<T>.AddRange() method:
Object reference not set to an instance of an object What am I doing wrong?
+4
4 answers