What is the difference b/t Arrays and hash List?
Which one is faster?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pradeep ShetPosted Oct 16, 2014, 5:16 AM
ArrayList works on indexing whereas HashTable works on Key.
In case of ArrayList, when you ask for any index it will iterate through the list and then fetch the desired index whereas for HashTable it will directly fetch the value based on the key.
Hope this helps you. If it is so plz mark it as answered.
Munesh SharmaPosted Oct 16, 2014, 6:43 AM
Munesh SharmaPosted Oct 16, 2014, 6:42 AM
An
ArrayListis a dynamic array that grows as new items are added that go beyond the current capacity of the list. Items in ArrayList are accessed by index, much like an array.The
Hashtableis a hashtable behind the scenes. The underlying data structure is typically an array but instead of accessing via an index, you access via a key field which maps to a location in the hashtable by calling the key object'sGetHashCode()method.In general,
ArrayListandHashtableare discouraged in .NET 2.0 and above in favor ofListandDictionarywhich are much better generic versions that perform better and don't have boxing costs for value types.http://dotnet-munesh.blogspot.in/2013/12/difference.html