Dotnet Programming Concepts Difference FAQs-1
Dotnet Programming Concepts Difference FAQs-1
to the list Retrieving data using Arraylist is slower than Hashtable because If we want to find something in a arraylist we have to go through each value in arraylist. Hash table Hash Table is a map Here, we can add data with the key Retrieving by key in Hashtable is faster than retrieving in Arraylist because If we want to find something in a hashtable we dont have to go through each value in hashtable, instead search for key values and is faster.
Difference between Hash Table and Arrays Hash Table Hash table stores data as name,value pair. To access value from hash table, we need to pass name. We can store different type of data in hash table, say int,string etc. Difference between Dictionary and Hashtable Dictionary Dictionary is a generic type Hashtable Hashtable is not generic type. Array Array stores only value In array, to access value , we need to pass index number. In array ,we can store only similar type of data.
In Dictionary we need to specify the types of Hashtable is a collection of name/value pairs both the key and the corresponding value.The that are organised on the basis of hash code of value represents the actual object stored and the the key being specified. key represents a means to identify a particular object. In Dictionary public static members are type safe but any instance members are not type safe. Hashtable is thread safe for use by multiple reader threads and a single writing thread.
We cannot use Dictionary with Web Services We can use Hashtable withWeb Services The reason is no web service standard supports generic standard. Dictionary is aster than Hashtable because boxing is not required. It is slower than dictionary because to retrieve a value we must cast it as its actual type, because it will be returned via object reference.
Difference between array and stack Array An array can be multi-dimensional An array allows direct access to any of its elements Stack Stack is strictly one-dimensional With a stack, only the 'top' element is directly accessible; to access other elements of a stack, we must go through them in order, until we get to the one we want
Difference between Stack and Heap Stack Memory will be allocated at the compile time. Here the memory is allocated by the compiler. Memory will be allocated only in sequential locations. The memory will also be deleted by the compiler. There is lot of chance of memory wastage. Heap Memory will be allocated at the run time. Here the memory is allocated by the user. Memory will be allocated in sequential locations and non- sequential locations. The memory must be deleted explicitly by the user. There is no chance of memory wastage if the memory is handled perfectly.
Difference between Array and ArrayList Array They are fixed length. They are compiled strong type collection. Because arrays are of fixed size and strong type collection performance is faster. Array is in the System namespace Ex:Char[] vowel=new Char[]; ArrayList They are resizable and variable length They are flexible and can accommodate any data types. In arraylist lots of boxing and unboxing are done there for its performance is slower. ArrayList is in the System.Collections namespace. Ex:ArrayList a_list=new ArrayList();