This is a summary of my experiments. // Wu xinqiang's: 20 using System; using System on March 03, 2013. collections. generic; using System. linq; using System. text; using System. diagnostics; namespace Chapter3_Sort {class CArray {static void Main (string [] args) {CArray ca = new CArray (200); Timing tObj = new Timing (); random random = new Random (10000); // Random number for (int I = 0; I <200; I ++) {ca. insert (random. next (0, 10000);} Console. writeLine ("Before Sorting:"); // Console Before Sorting. writeLine (); ca. displayElements (); // display the data Console. writeLine (); // line feed tObj. startTime (); // test the Console at the start time of the sorting time. writeLine (); Console. writeLine ("During Sorting:"); // Console in Sorting. writeLine (); ca. bubbleSort (); // call the bubble sort method to sort the logs. writeLine (); tObj. stopTime (); // test the end time of the sorting time Console. writeLine ("After Sorting:"); // Console After Sorting. writeLine (); ca. displayElements (); // display the data Console. writeLine (); Console. writeLine ("time (. net): "+ tObj. result (). totalSeconds + "S"); // display the total time used by the bubble sort method Console. writeLine ();} public void BubbleSort () // bubble sort {int temp; for (int outer = upper; outer> = 1; outer --) {for (int inner = 0; inner <= outer-1; inner ++) {if (int) array [inner]> array [inner + 1]) {temp = array [inner]; array [inner] = array [inner + 1]; array [inner + 1] = temp ;}} this. displayElements () ;}} private int [] array; private int upper; private int numElements; public CArray (int Size) {array = new int [Size]; upper = Size-1; // maximum upper length numElements = 0; // array variable} public void Insert (int item) {array [numElements] = item; numElements ++ ;} public void DisplayElements () // display data {for (int I = 0; I <= upper; I ++) Console. write (array [I] + "");} public void Clear () // delete data {for (int I = 0; I <upper; I ++) {array [I] = 0; numElements = 0 ;}} public class Timing // time test class {TimeSpan duration; public Timing () {duration = new TimeSpan (0 );} public void StopTime () {duration = Process. getCurrentProcess (). totalProcessorTime;} public void StartTime () {GC. collect (); GC. waitForPendingFinalizers ();} public TimeSpan Result () {return duration ;}} lab Result: