Introducing DotNetFunda.com on mobile http://m.dotnetfunda.com ! Be with DotNetFunda.com on the go !
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 605 |  Welcome, Guest!   Register  Login
Home > Articles > C# > Specialized String Collection Types in .NET 2.0

Specialized String Collection Types in .NET 2.0

Article posted by Initiotech on 9/16/2009 | Views: 3635 | Category: C# | Level: Intermediate red flag


This article will introduce some of the String Specialized Classes in DotNet Framework 2.0

Strings the most commonly used data type .Many a times we may also use strings in Collections. The .NET Framework introduces special collection types to store string values which are the StringDictionary and the StringCollection classes which are from the System.Collections.Specialized.

First we see the StringCollection

The StringCollection class is a collection type used to store only string values the benefits of using StringCollection type is its type safe to use it when one is working with collection of string values.

StringCollection stringColl=new StringCollection();
stringColl.Add("Hefin");
stringColl.Add("DotNet");
stringColl.Add("Visual Basic");
string val=stringColl[1];//Does not need type casting like in ArrayList

Now for the StringDictionary class.
This class is similar to the HashTable class except for the keys and the values both have to be strings.

StringDictionary strDic=new StringDictionary();
strDic.Add("A","Hefin");
strDic["a"]="MyWorld" // Note that the keys are by default case insensitive
strDic.Add("B","Cool World");
string getVal=strDic["B"];

Hope these new specialized collection types for strings come handy for you.

Regards
Hefin Dsouza

If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About Hefin Dsouza

Experience:8 year(s)
Home page:http://hefin.in
Member since:Wednesday, September 16, 2009
Level:Starter
Status: [Member]
Biography:My Name is Hefin Dsouza.
I am a faculty at Computer Education Institute.I am also an Freelance Software Developer and Software Trainner.I am working with DotNet Technologies from the past 8 years.I am an Microsoft Certified Windows Application Developer for .NET 3.5.
And also a Blogger at http://blog.hefin.in
>> Write Response - Respond to this post and get points
Related Posts

Generally in many websites after you get logged in you will be redirected to home page. While this page is running if the user selects the new window and open the Login page again and if he provides the same credentials which was provided earlier then he will be automatically redirected to home page. But in this article I am going to explain how to restrict this if you consider the examples of gmail.com or yahoo.com once in a particular user is logged in they won’t restrict the user but here I will provide that feature and check whether if a particular user is logged in I will display it as already logged in.

This article is very useful in term of using lambda expression.I can remember my old days there if you want to do sorting on multiple fields using Arrays or List then you have to write lot of code but now thanks to lambda expression which gives us unique functionality in .Net.

To infer about how the reference types are passed to a method and what is the outcome.

Definition of Overrtide for Beginners with the help of a example.

This article covers the detailed feature an interface.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/27/2012 7:39:56 PM