C#
  Home arrow C# arrow Working with C# Collections
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Working with C# Collections
By: Barzan "Tony" Antal
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2008-12-16

    Table of Contents:
  • Working with C# Collections
  • Various Collections
  • Tell Me More!
  • Final Thoughts

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Working with C# Collections


    (Page 1 of 4 )

    Computer programming is all about working with data. Data can be of various types and kinds and take multiple shapes and forms, but with the help of programming languages we are able to manage them seamlessly. In this article we are going to take a look at what collections are all about and how to implement them in C#. For now it’s enough if you know that under collections we understand data that’s grouped together.Fortunately, ever since its first version, the .NET Framework has given programmers a healthy amount of built-in collections classes along with numerous methods that allow us to easily manipulate the data stored within. Of course, we can also write our own collections, but throughout this article we are going to focus on what’s already been done and is ready to use. We need to understand when and how to use each.

    At the beginning we will see the foundation on which each collection class lies. It’s really important to understand the interface on which they are based: IEnumerable and its ICollections extension. From the latter there are two other interfaces derived: IList and IDictionary. The collections classes which are built into the System.Collections namespaces are always implementing each of the aforementioned interfaces. However, keep in mind that there are other interfaces too (e.g.; IEnumerator, IComparer, etc.).

    Before we move on, here’s a list of collection classes that are going to be covered within this brief tutorial article: Queue, Stack, BitArrays, ArrayList, StringCollection, Hashtable, SortedList, ListDictionary, StringDictionary, and so forth. There are so-called generic classes which can be reached via the System.Collections.Generic namespace, but they are strongly typed collections.

    Now we are ready to move on. Once again, to eliminate all kinds of problems be sure to include the following namespaces into your test projects on which you are going to be working while reading this article: System.Collections, System.Collections.Generic, and System.Collections.Specialized. But it’s worth taking a glance over the official documentation to see which one you’re going to need.

    More C# Articles
    More By Barzan "Tony" Antal


       · Thank you for reading this article. In this publication I've shown you how to work...
     

    C# ARTICLES

    - Coding a CRC-Generating Algorithm in C
    - Cyclic Redundancy Check
    - Handling Methods and Functions
    - Destroying Objects in C#
    - Creating Objects in C-Sharp
    - Classes and Objects
    - Programming Languages: Managed versus Native
    - LINQ-to-MySQL with DbLinq in C#
    - Working with Dates and Times in C#
    - Generics, Dictionaries, and More
    - More About Generics
    - Working with C# Collections
    - Generics
    - C# and XML
    - Pointers and Arrays in C#





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek