Code reading summary of asp.net startkit timetracker

Source: Internet
Author: User
Tags sort

Custom collection class sorting (sort ()) method essays

Many custom collection classes are defined in the ASP.net startkit timetracker

For example:

Userscollection

Timeentriescollection

Wait a minute

They're all subclasses of the ArrayList class.

For example:

Timeentriescollection Store Custom Class Timeentry

These custom collection classes implement sorting method sort

Let's look at a piece of code I wrote:

Using System;
Using System.Collections;
Namespace Arraylistsort
{
class Class1
{
[STAThread]
static void Main (string[] args)
{
ArrayList a=new ArrayList (8);
A.add (a);
A.add (2);
A.sort ();
IEnumerator Ienumerator=a.getenumerator ();
while (Ienumerator.movenext ())
{
Console.WriteLine (iEnumerator.Current.ToString ());
ArrayList b=new ArrayList (8);
B.add (New Class2 ("Wo"));
B.add (New Class2 ("AI"));
B.add (New Class2 ("I"));
B.sort ();
IEnumerator Iienumerator=b.getenumerator ();
while (Iienumerator.movenext ())
{
Console.WriteLine ((Class2) iienumerator.current).      A);
}
Console.ReadLine ();
}
public
class Class2
{public
class2 (string str)
{
this.a=str;
}
string A;
public string a
{
get
{
A;
}}}
                    

Related Article

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.