Collections and Special Collections

Source: Internet
Author: User

namespace sets and Special collections
{
Class Program
{
static void Main (string[] args)
{
ArrayList al = new ArrayList ();
Al. Add ("Li Qing");
Al. ADD ("John Rick");
Al. ADD ("Anne");
Al. ADD ("Galen");
Al. ADD ("card Sardinia");
Al. ADD ("brand");
Al. ADD ("Noxus's Hand");
Al. ADD ("Weapon Master");
Al. ADD ("Nash's Teeth");
Al. Add ("Blind Monk");
Al. ADD ("Galen");
Al. ADD ("Katrina");
Al. ADD ("Nine-tailed demon fox");
for (int i = 0; i < al. Count; i++)
//{
Console.WriteLine (Al[i]);//output in sequence
//}

Console.WriteLine (al. Contains ("Hand of Noxus"));//See if it contains
Console.WriteLine (al. IndexOf ("Catalina"));///See where Catalina is located (index)
Al. Insert (3, "de Eris");//In the third place before inserting a de Eris
for (int i = 0; i < al. Count; i++)
//{
Console.WriteLine (Al[i]);
//}
Al. LastIndexOf ("Galen");
Console.WriteLine (al. LastIndexOf ("Galen"));//The location of the last Galen
Al. Remove ("John Rick");//Delete the Yorick
for (int i = 0; i < al. Count; i++)
//{
Console.WriteLine (Al[i]);//output in sequence
//}
Al. RemoveAt (3);
for (int i = 0; i < al. Count; i++)
//{
Console.WriteLine (Al[i]);//output in sequence
//}
Al. Sort ();//Sort by initials
for (int i = 0; i < al. Count; i++)
//    {
Console.WriteLine (Al[i]);//output in sequence
//    }
Al. Reverse ();//Flip the entire collection
for (int i = 0; i < al. Count; i++)
{
Console.WriteLine (Al[i]);//output in sequence
}
Console.ReadLine ();
}
}
}

Collections and Special Collections

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.