Professional ASP.NET 1.1 [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Professional ASP.NET 1.1 [Electronic resources] - نسخه متنی

Alex Homeret

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید


"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">








  • System.Collections.Specialized Namespace

    The System.Collections.Specialized namespace contains collection classes that are suited to specialized tasks, as well as collection classes that are strongly typed, which, although it limits the types that can be contained, reduces the amount of casting needed.


    The StringCollection Class


    The System.Collections.Specialized.StringCollection class provides an implementation of an ArrayList that can only contain string values. This class implements all of the functionality of ArrayList, but does all of the casting behind the scenes. Like ArrayList, StringCollection implements the IList interface.

    Here is a simple example of using the StringCollection class in C#:


    StringCollection names = new StringCollection();
    names.Add("Richard");
    names.Add("Sam");
    names.Add("Richard");
    names.Add("Sam");
    foreach (String name in names)
    {
    Response.Write("<br />" + name);
    }


    The StringDictionary Class


    The System.Collections.Specialized.StringDictionary class provides an implementation of a hash table, in which the key and value are always of type System.String. The key is also case- insensitive. Internally, this class uses the Hashtable class for its implementation. If you're interested only in dealing with string values, you should use this class.

    The following C# code shows how to use StringDictionary to locate the surname of a given person:


    StringDictionary names;
    string surname;
    names = new StringDictionary();
    names["Richard"] = "Anderson";
    names["Alex"] = "Homer";
    surname = names["Alex"];
    Response.Write("The surname for alex is " + surname);

  • / 243