Monday, July 2, 2012

.NET Mobile overview

.NET Mobile overview


.NET Mobile is a platform for developing applications for mobile phones. It’s an extension to .NET Framework and is called Microsoft Mobile Internet Toolkit. It is a set of server side forms controls. These controls produce different output formats i.e. WML, HTML or even compact HTML. This allows developers to create an application using a single paradigm instead of developing an application multiple times using different paradigms based on what different mobiles support. The advantage is standardization, less redundancy, and Microsoft support.

Handle Exceptions in .NET 2.0


Explain how to Handle Exceptions in .NET 2.0.


There are different methods for handling the exceptions. For example


Method 1 :


try
{
     // code here
}
catch(Exceptiontype *etype_object)
{
     // code here.
}


Method 2 :
try
{
       // code
}
catch(Exceptiontype *etype_object)
{
        throw new Custom_Exception();
}

Difference between object pooling and connection pooling


How does object pooling and connection pooling differ?


In Object pooling, you can control the number of connections. In connection pooling, you can control the maximum number reached.


When using connection pooling, if there is nothing in the pool, a connection is created since the creation is on the same thread.


In object pooling, the pool decides the creation of an object depending on whether the maximum is reached which in case if it is, the next available object is returned. However, this could increase the time complexity if the object is heavy.

Sunday, July 1, 2012

Object Pooling in .NET


What is an object pool in .NET?


An object pool is a container of objects that holds a list of other objects that are ready to be used. It keeps track of following:
Objects that are currently in use
The number of objects the pool holds
Whether this number should be increased
The request for the creation of an object is served by allocating an object from the pool.


This reduces the overhead of creating and re-creating objects each time an object creation is required.

Why is an Object Pool required

Why is an Object Pool required?


To enhance performance and reduce the load of creating new objects, instead re using existing objects stored in memory pool. 
Object Pool is a container of objects that are for use and have already been created. Whenever an object creation request occurs, the pool manager serves the request by allocating an object from the pool. This minimizes the memory consumption and system's resources by recycling and re-using objects. 
When the task of an object is done, it is sent to the pool rather than being destroyed. This reduces the work for garbage collector and fewer memory allocations occur.