## Introduction

In this blog, we are discussing the linked list concepts with simple programs.

The linked list is an abstract data type that represents the family of data structures where data structures represent a linear and sequential way.
• Please check the below snapshot:

We can see in the above snapshot A, B, C, that these are nodes. A node has two elements, data, and pointer. A pointer points towards to the next node. A points towards B and B points towards C.

We have 3 types of linked lists:
1. Simple linked list: We have a node and the node points towards the next node. Here we have a one-way pointer.
2. Double linked list: Node points towards the next node, also it will point to the previous node.
3. Circular linked list: Every node will point towards the next node and also the last node points to the first node.
Let's create a simple linked list.

Step 1

First, create a simple console application.

Step 2

First, we need to create one node. Please create one class and name it as a node. This class has two properties, one is data and another one is the pointer.
1. using System;
2. using System.Collections.Generic;
3. using System.Text;
4.
6. {
7.    public class Node
8.     {
9.         object data = null;
10.         Node next = null;
11.     }
12. }
Step 3

In the AddFirst method, it will add data before the current head. First, we need to create the first item and we want this as our first item so we need to set items as the head.
2.         {
3.             Node newitem = new Node();
4.             newitem.data = data;
7.         }
In the AddLast method, we are creating the last node. Loop and find the last node and if it is null this means this is the last element to the current next set new item.
2.        {
3.
4.            Node newitem = new Node();
5.            newitem.data = data;
6.            // if head is null that means it is the first item and  add the  new item and  set next node to null
8.            {
9.
12.            }
13.            else
14.            {
15.                // if the head is not null and find out the last node by loop
17.                while(current.next  != null)
18.                {
19.                    current = current.next;
20.                }
21.
22.                current.next = newitem;
23.            }
24.
25.
26.        }
In the ReadAll method using a loop, we can read the data of the node.
2. {
4.     // loop until the last node
5.     while(current.next !=null)
6.     {
7.         Console.WriteLine(current.data);
8.        current = current.next;
9.     }
10.
11.     Console.WriteLine(current.data);
13.
14. }
In your main method, create the object for class and run the application.
1. class Program
2.     {
3.         static void Main(string[] args)
4.         {