

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Program to remove a node at the beginning of a Linked List
To remove a node at the beginning of a LinkedList, use the RemoveFirst() method.
string [] employees = {"Peter","Robert","John","Jacob"}; LinkedList<string> list = new LinkedList<string>(employees);
Now, to remove the first element, use the RemoveFirst() method.
list.RemoveFirst();
Let us see the complete example.
Example
using System; using System.Collections.Generic; class Demo { static void Main() { string [] employees = {"Peter","Robert","John","Jacob"}; LinkedList<string> list = new LinkedList<string>(employees); foreach (var emp in list) { Console.WriteLine(emp); } // removing first node list.RemoveFirst(); Console.WriteLine("LinkedList after removing first node..."); foreach (var emp in list) { Console.WriteLine(emp); } } }
Output
Peter Robert John Jacob LinkedList after removing first node... Robert John Jacob
- Related Questions & Answers
- C# Program to remove a node at the end of the Linked List
- Python program to insert a new node at the beginning of the Doubly Linked list
- Python program to insert a new node at the beginning of the Circular Linked List
- Write a program in C++ to insert a Node at the beginning of the given Singly linked list
- C# program to remove the first occurrence of a node in a Linked List
- Python program to delete a new node from the beginning of the doubly linked list
- C# Program to add a node at the first position in a Linked List
- C# Program to add a node at the last position in a Linked List
- Golang Program to add a node at the end of a given linked list.
- Remove First Node of the Linked List using C++
- Remove Last Node of the Linked List using C++
- C program to insert a node at any position using double linked list
- Delete a Linked List node at a given position in C++
- Python program to insert a new node at the end of the Doubly Linked List
- Python program to insert a new node at the middle of the Doubly Linked List
Advertisements