using System;using System.Collections.Generic;using System.Linq;using System.Web;namespace MvcTreeView{ public class DLinkedListNode { } public class DLinkedListNodeEntity { public object element; public DLinkedListNodeEntity nextNode; private DLinkedListNodeEntity previousNode; public object Element { get { return this.element; } set { this.element = value; } } public DLinkedListNodeEntity Next { get { return this.nextNode; } set { this.nextNode = value; } } public DLinkedListNodeEntity Previous { get { return this.previousNode; } set { this.previousNode = value; } } public DLinkedListNodeEntity(object element) { this.element = element; this.Next = null; this.Previous = null; } public DLinkedListNodeEntity(object element, DLinkedListNodeEntity prevNode, DLinkedListNodeEntity nextNode) { this.element = element; this.Previous = prevNode; this.Next = nextNode; } } public class DLinkedList { private DLinkedListNodeEntity head; private DLinkedListNodeEntity tail; private int count; public DLinkedList() { this.head = null; this.tail = null; this.count = 0; } public int Count { get { return this.count; } } public object thisint index { get { if (index >= count || index < 0) { throw new ArgumentOutOfRangeException("Out of range!"); } DLinkedListNodeEntity currentNode = this.head; for (int i = 0; i < index; i++) { currentNode = currentNode.Next; } return currentNode.Element; } set { if (index >= count || index < 0) { throw new ArgumentOutOfRangeException("Out of range!"); } DLinkedListNodeEntity currentNode = this.head; for (int i = 0; i < index; i++) { currentNode = currentNode.Next; } currentNode.Element = value; } } public void Add(object item) { if (this.head == null) { this.head = new DLinkedListNodeEntity(item); this.tail = this.head; } else { DLinkedListNodeEntity newItem = new DLinkedListNodeEntity(item, tail,head); this.tail = newItem; } count++; } }}