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