Thursday, October 11, 2012

An Overview About Generics In C#.NET

History:

The approach of generic programming has been started in 1983 by Ada programming language to reduce the duplication of code by writing a common set of methods and types that differ only by types or environment they are being used.

Introduction:

The term generic programming was originally coined by two guys named David Musser and Alexander Stepanov  to describe an approach for software decomposition. In this approach fundamental requirements on types are abstracted from across concrete examples of algorithms and data structures.

So in general terms generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are instantiated when needed for specific types provided as parameters.

An Overview Of Dictionary In C#.NET

Dictionary in C# :




  • Dictionary is a generic class that belongs to System.Collection namespace in .NET.

  • The dictionary type in C# allow user to retrieve corresponding value very fast with key value.

  • A dictionary can store Keys and Values of any data type in .NET.

  • It provides a mapping from a set of keys to a set of values .

  • Represented as Dictionary<TKey, TValue> pair where TKey represents Key and TValue represents the value associated with the key.

Tuesday, October 09, 2012

Optimization Of Stored Procedure In SQL Server

This article describes that how we can optimize the Stored Procedures so that we can get better performance while our application is talking to database. I am enlisting some of the points from my personal experience.

 

1)    Always Use Fully Qualified Name For All Database Objects:


While working with stored procedure we need to pass name of database objects (table, view, function, other stored procedure(s) etc.) several times. I recommend every developer to use fully qualified object names instead of using only object name. There is a very strong reason behind this recommendation.





  • SQL server always has to find supplied database object name from sys object that took some millisecond of processing time and consumption of CPU resources. And if, we pass fully qualified name then that processing time and CPU resource consumption to search the object from sys objects get reduced to significant amount.



  • Another reason behind the scene is it helps SQL Server to directly finding the Complied Cache Plan if available instead of searching the objects in other possible schema. This process of searching and deciding a schema for a database object leads to COMPILE lock on stored procedure which decreases the performance of a stored procedure.



Wednesday, October 03, 2012

Overview Of List Type In C#.NET

List Class : List is a member of System.Collection namespace in .NET which is having lots of features. 

Declaration: List is declared as follows. 

               List<int> list = new List<int>(); 

Description:



  1. List type in C# resizes itself if required hence you don’t need to worry for size of List.



  2. Used for Linear Collection which are not accessed by Keys.



  3. Lists are considered generics and constructed types.



  4. We must have to use <> (angle bracket) in the List declaration.



  5. It provides many attributes and methods to work with List type; some of them are described with example below.