Click here to Skip to main content
15,886,067 members
Articles / Programming Languages / C#

Basics of .NET Collections in C#

Rate me:
Please Sign up or sign in to vote.
3.46/5 (32 votes)
10 Dec 2008CPOL6 min read 325.8K   2.6K   73  
This article focuses on managing collections in .NET Framework 2.0.
using System;
using System.Collections.Generic;
using System.Text;

namespace DotNetCollections
{
    public class Utility
    {
        /// <summary>
        /// Method to convert ToString()
        /// </summary>
        /// <param name="objects">objects array</param>
        /// <returns></returns>
        public static string ConvertToString(Array objects)
        {
            string strToReturn = string.Empty;

            if (objects != null)
            {
                foreach (object obj in objects)
                {
                    if (strToReturn.Length > 0)
                        strToReturn += ", ";

                    strToReturn += obj.ToString();
                }
            }
            return strToReturn;
        }

        public static string ConvertToString(System.Collections.ArrayList objects)
        {
            string strToReturn = string.Empty;

            if (objects != null)
            {
                foreach (object obj in objects)
                {
                    if (strToReturn.Length > 0)
                        strToReturn += ", ";

                    strToReturn += obj.ToString();
                }
            }
            return strToReturn;
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
Pakistan Pakistan
Passion and positive dedication is essential part of success. I believe on hardworking and sharing knowledge with others. I always try to be a better than I am and think positive for positive result.

My Blogs

My Linked-In Profile

Comments and Discussions