All pastes #904239 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-14 20:25 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Node<T>
    {
        private T info;
        private Node<T> NextNode;
        public Node(T info)
        {
            this.info = info;
            this.NextNode = null;
        }
        public Node(T info, Node<T> NextNode)
        {
            this.info = info;
            this.NextNode = NextNode;
        }
        public Node<T> GetNextNode()
        {
            return this.NextNode;
        }
        public T GetInfo()
        {
            return this.info;
        }
        public void SetNextNode(Node<T> NextNode)
        {
            this.NextNode = NextNode;
        }
        public void SetInfo(T info)
        {
            this.info = info;
        }
        public override string ToString()
        {
            return "info= " + this.info;
        }
    }
    class PrintAll
    {
        public static void Print<T>(Node<T> Node)
        {
            while (Node != null)
            {
                Console.WriteLine(Node.ToString());
                Node = Node.GetNextNode();
            }
        }
    }
}