The use method of list in asp.net _ Practical skills

Source: Internet
Author: User
However, it is written in the traditional C-style grammar structure,. NET some of the convenient data structures are not used, and occasionally see. net2.0 support generics, used a bit, oh, yes! I'm blessed to be a lazy man! So write it down and make a note!

Program code
Copy Code code as follows:

Console.WriteLine ("List Test:");
Declare a list of integral types
list<int> lstest = new list<int> ();
Lstest.add (7);
Lstest.add (5);
Lstest.add (1);
Lstest.add (3);
String Strtest= "";
Sort of List
Lstest.sort ();
The traversal of the list
foreach (int i in lstest)
Strtest+=i.tostring () + "";
Formatted after the output of
Console.Write (String. Format ("out:{0} \ncount:{1}\n", Strtest,lstest.count));
Read the next key to allow the screen to display data
Console.readkey ();

The output is as follows

Program code
Copy Code code as follows:

List Test:
Out:1 3 5 7
Count:4

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.