C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Generic Collections - Feature of DotNet 2.0


Posted Date: 04 Sep 2008    Resource Type: Articles    Category: .NET Framework

Posted By: VASANTH R       Member Level: Gold
Rating:     Points: 7



Suppose if we want to store collection of integer, then we could write code something like,
ArrayList MyList = new ArrayList();
MyList.Add(1);
MyList.Add(2);

It will work good. Suppose if we add like,
MyList.Add("3");
It will compile without error. If we loop through each item and converting it to integer we will got exception thrown.

To avoid this we will go for Generic Type
ArrayList Equivalent Generic Type is List

List MyList = new List();
MyList.Add(1);
MyList.Add(2);
MyList.Add("3"); ---> this will give you complier Error




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Generics  .  Feature of dotnet2005  .  Collections  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Application Performance - Caching
Previous Resource: SQL User Defined Functions
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use