Skip to main content

Posts

Showing posts with the label Generic Class

Linked List in ASP.NET

Create a Linked link or Generic List in Asp.Net A Simple way to create a Linked List in ASP.Net C# by using List&ltT&gt = new List&ltT&gt(); Class. &ltT&gt Can be any data type or user defined class. Like, if you want to create a List of Sting or int datatype. List&ltString&gt LS= new List&ltString&gt(); or List&ltint&gtLI= new List&ltint&gt(); to add nodes in List: LS.Add("U"); LS.Add("M"); LS.Add("R"); or LI.Add(7); LI.Add(8); LI.Add(6); List will be shown like this : U->M->R or 7->8->6 If you want to add more than one variables in one Node then you need to create a class for that. For exp u want to store Name and Age of student in a node. Then you first create a user defined class for that. class Node { public String Name; public int Age = 0; public Node() { } public Node(String data, ag) { this.Name = data; this.Age=ag; } } He...