Programming Tutorials on XHTML, CSS, JavaScript, JQuery, JSON, Python, Django, Amazon Web Services, ASP.NET, Web Forms, and SQL
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.
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.
GetCommandLineArgs() method in C# .NET
What is the use of GetCommandLineArgs() method in C#.NET?
With GetCommandLineArgs() method, the command line arguments can be accessed.
The value returned is an array of strings.
Compare C# .NET Generics and C++ Templates
How does C#.NET Generics and C++ Templates compare?
C# generics and templates in C++ are more or less similar syntactically.
C# Generic types are strong typed. C++ Templates are loosely typed.
C# Generic types are instantiated at the runtime. C++ templates are instantiated at the compile time.
C# Generic types do not permit the type parameters to have default values. C++ templates do.
Achieve polymorphism in C# .NET
How to achieve polymorphism in C#.NET?
Polymorphism is when a class can be used as more than one type through inheritance. It can be used as its own type, any base types, or any interface type if it implements interfaces.It can be achieved in the following ways.
Derived class inherits from a base class and it gains all the methods, fields, properties and events of the base class.
To completely take over a class member from a base class, the base class has to declare that member as virtual.
Subscribe to:
Posts (Atom)