Difference between array, arraylist, List, Hashtable, Dictionary and SortedList in c#

Basic difference is that arrays are of fixed size. Whereas an ArrayList implements the list data structure and can dynamically grow. While arrays would be more performance that a list, a list would be far more flexible since you don't need to know the required size initially. Array - represents an old-school memory array - kind of like a alias for a normal type[] array. Can enumerate. Can't grow automatically. I would assume very fast insertion, retrieve and speed. ArrayList - automatically growing array. Adds more overhead. Can enum., probably slower than a normal array but still pretty fast. These are used a lot in .NET List - one of my favorites - can be used with generics, so you can have a strongly typed array, e.g. List . Other than that, acts very much like ArrayList. Hashtable - plain old hashtable. O(1) to O(n) worst case. Can enumerate the value and keys properties, and do key/val pairs. Dictionary - same as above only strongly typed via generics, such a...

What are the State Management options in ASP.NET ?

There are two types of state management in asp.net i.e Client-side state management and Server-side state management

Client-side state management - This maintains information on the client’s machine using either of the following options –
  • Cookies - Cookie is a small sized text file on the client machine either in the client’s file system or memory of client browser session.
  • View State - Each page and control on the page has View State property. This allows automatic retention of page and control’s state between each trip to server.
  • Query string - Query strings can maintain limited state information. Data has been passed from one page to another with the URL, but you can send limited size of data with the URL.
Server-side state management - This mechanism retains state in the server. Below are the options to achieve it -
  • Application State - The data stored in the application object can be shared by all the sessions of the application.
  • Session State - Session State stores session-specific information and the information is visible within the session only.

Comments

Popular posts from this blog

C# Interview Questions on Inheritance

C# Interview Questions on value types and reference types

Why to use UpdatePanel control in AJAX ASP.NET?