I have an ArrayList that stores 100,000+ numbers inside of it. Each number is 10 digits in length or smaller. The program itself has data input into it, of which it loops through the user input to see if any of their numbers are already in the array using if ArrayList.Contains(userinput).
It would appear that when having an ArrayList of this size a LOT of memory is being used. Would there be a faster way to run this, E.g. Database or If TextFile.Contains(Line)?
You should use a
List<T>to avoid boxing and save memory.Using a
HashSet<T>will be much faster, but will use a little more memory than aList<T>.Depending on your precise scenario, a database would probably be best.