using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Collections;
using conapp2.dll;
using System.Text.RegularExpressions;
using System.Diagnostics;
namespace conapp2
{
class
Program
{
static void Main(string[] args)
{
SortedSet list = new SortedSet();
Student st = new Student("andy", 25, 100);
list.Add(st);
//st = new Student("andy", 25, 100);
//list.Add(st);
st = new Student("jack", 70, 60);
list.Add(st);
st = new Student("andy", 25, 50);
list.Add(st);
st = new Student("lucy", 60, 80);
list.Add(st);
st = new Student("tom", 40, 40);
list.Add(st);
foreach (Student stu in list)
{
Console.WriteLine(stu.Name+"\t"+stu.Age+"\t"+stu.Score);
}
Console.ReadLine();
}
}
///
///
生命一个Student类(该类还要继承IComparable借口)
///
class
Student : IComparable
{
//定义三个属性
public string Name { get; set; }
public int Age { get; set; }
public float Score { get; set; }
//对属性进行初始化
public Student(string name, int age, float score)
{
this.Name = name;
this.Age = age;
this.Score = score;
}
///
/// 实现IComparable借口中CompareTo的方法
///
///
///
public int CompareTo(Student y)
{
if (this.Score > y.Score)//先按分数进行排序
{
return 1;
}
else if (this.Score < y.Score)
{