예제 #1
0
        public void Add(T value)
        {
            var node = new JeongListNode <T>();
            JeongListNode <T> current;

            node.list = this;
            node.Data = value;


            if (Head == null)
            {
                Head = node;
                count++;
            }
            else
            {
                current = Head;
                int cc = 0;
                while (current.Next != null)
                {
                    current = current.Next;
                }
                current.Next = node;
                node.Next    = null;
                count++;
            }
        }
예제 #2
0
        public void RemoveAt(int Index)
        {
            var curr = Head;
            var prev = Head;
            int i    = 0;

            if (Index > _Count)
            {
                Console.Write("에러  인덱스 범위 초과 하엿습니다");
            }

            if (Index == 0)
            {
                Head = Head.Next;
                count--;
            }
            else
            {
                while (curr != null)
                {
                    if (i == Index)
                    {
                        var temp = curr.Next;
                        prev.Next = temp;
                        count--;
                        // Console.WriteLine("temp :::" + temp.Data + "   prev:::" + prev.Data);
                        return;
                    }
                    prev = curr;
                    curr = curr.Next;
                    i++;
                }
            }
        }
예제 #3
0
        public void Clean()
        {
            Head = null;

            count = 0;
            return;
        }
예제 #4
0
 public JeongListNode()
 {
     Data = default(T);
     Next = null;
     list = null;
 }