Пример #1
0
        public void Add(T val)
        {
            if (!object.Equals(val, default(T)))
            {
                NodeValue <T> node = new NodeValue <T>(val);

                if (first == null)
                {
                    first      = node;
                    currentAdd = node;
                    currentGet = node;

                    currentAdd.Next = node;
                }
                else
                {
                    node.Next = first;

                    var lastNode = currentAdd;
                    currentAdd = node;

                    lastNode.Next = currentAdd;
                }
            }
        }
Пример #2
0
        public T Get()
        {
            if (first == null)
            {
                return(default(T));
            }

            var resp = currentGet;

            currentGet = currentGet.Next;

            return(resp.GetValue());
        }