[RESOLVED] list.addrange question
Hi guys,
If i have a list of strings and i add the contents of a string array to it, using list.addrange(array) then does it copy the last element (that makes the array without any elements added have a length of 1) because i keep getting a null reference exception and have spent the last 3 hours trying to figure out where the null reference is coming from! :mad: lol
If it does then is there a way to copy all the elements without the null element at the end of the array?
Thanks for any help
:afrog:
Re: list.addrange question
When you call AddRange it simply adds every element of the array to the List. That's all. It doesn't affect the array in any way whatsoever. If any of the elements of the array are null references then the corresponding item in the List will also be a null reference.
How about providing some code because your post is just a little confusing? I don't really know where exactly you mean there's a problem: with the array or the List.
Re: list.addrange question
Thanks for your reply...but i have managed to come up with a solution. Instead of using list.addrange(array) i have simply replaced it with a for loop and used list.add(array(i)).
Thank you for your help though
:thumb:
:wave: