public string Print() { if (next != null) { return(data.ToString() + next.Print()); } else { return(data.ToString()); } }
public static void Main(string[] args) { int[] data = { 1, 2, 5, 4, 3 }; MainClass m = new MainClass(); Node list = new Node(null, data[0]); // 초기화는 따로 for (var i = 1; i < data.Length; i++) { list = new Node(list, data[i]); } Node a = m.Div(list, 5); Console.WriteLine(a.Print()); }