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 is an HttpHandler and its use in ASP.NET

In the simplest terms, A handler is responsible for fulfilling requests from a browser.

In ASP.NET HttpHandler is a class that implements the System.Web.IHttpHandler interface.
ASP.NET HTTPHandlers are responsible for intercepting requests made to your ASP.NET web application server. They run as processes in response to a request made to the ASP.NET Site. The most common handler is an ASP.NET page handler that processes .aspx files. When users request an .aspx file, the request is processed by the page through the page handler.
ASP.NET offers a few default HTTP handlers:
  • Page Handler (.aspx): handles Web pages
  • User Control Handler (.ascx): handles Web user control pages
  • Web Service Handler (.asmx): handles Web service pages
  • Trace Handler (trace.axd): handles trace functionality
You can create your own custom HTTP handlers that render custom output to the browser. Typical scenarios for HTTP Handlers in ASP.NET are for example
  • Delivery of dynamically created images (charts for example) or resized pictures.
  • RSS feeds which emit RSS-formated XML
You implement the IHttpHandler interface to create a synchronous handler and the IHttpAsyncHandler interface to create an asynchronous handler. The interfaces require you to implement the ProcessRequest method and the IsReusable property.
The ProcessRequest method handles the actual processing for requests made, while the Boolean IsReusable property specifies whether your handler can be pooled for reuse (to increase performance) or whether a new handler is required for each request.

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?