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