public class student:IComparable{
public student(int USN){this.USN=USN;}
public int RegNo{get{return USN;}}
int IComparable.CompareTo(object o){
if(this.USN>temp.USN) return 1;
if(this.USN<temp.USN) return -1;
public static void Main(string[] args){
student[] usestd=new student[3];
usestd[0]=new student(111);
usestd[1]=new student(100);
usestd[2]=new student(45);
catch(Exception e){Console.WriteLine(e.StackTrace);}
Console.WriteLine("Array after Sorting: ");
foreach(student s in usestd)
Console.WriteLine(s.RegNo);