Exemplo n.º 1
0
        public void run()
        {
            head            = peanut;
            peanut.dogname  = "peanut";
            peanut.dogbreed = "bichon";
            peanut.nextdog  = fifi;

            fifi.dogname  = "fifi";
            fifi.dogbreed = "poodle";
            fifi.nextdog  = roy;

            jordan.dogname  = "jordan";
            jordan.dogbreed = "german sheppard";
            jordan.nextdog  = fido;

            fido.dogname  = "fido";
            fido.dogbreed = "beagle";
            fido.nextdog  = null;

            roy.dogname  = "roy";
            roy.dogbreed = "apaniel";
            roy.nextdog  = coco;

            coco.dogname  = "coco";
            coco.dogbreed = "border collie";
            coco.nextdog  = jordan;
        }
Exemplo n.º 2
0
 public void walkoverthelist()
 {
     current = head;
     while (current != null)
     {
         Console.WriteLine(current.dogname);
         current = current.nextdog;
     }
 }