
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
LinkedList RemoveFirst() Method in C#
Let’s say the following is our LinkedList with integer nodes.
int [] num = {29, 40, 67, 89, 198, 234}; LinkedList<int> myList = new LinkedList<int>(num);
Now, if you want to remove the first element from the list, then use the RemoveFirst() method.
myList.RemoveFirst();
Example
using System; using System.Collections.Generic; class Demo { static void Main() { int [] num = {29, 40, 67, 89, 198, 234}; LinkedList<int> myList = new LinkedList<int>(num); foreach (var n in myList) { Console.WriteLine(n); } // removing first node myList.RemoveFirst(); Console.WriteLine("LinkedList after removing the first node..."); foreach (var n in myList) { Console.WriteLine(n); } } }
Output
29 40 67 89 198 234 LinkedList after removing the first node... 40 67 89 198 234
- Related Articles
- What does the method removeFirst() do in java?
- LinkedList AddFirst method in C#
- LinkedList AddAfter method in C#
- LinkedList Remove method in C#
- LinkedList RemoveLast() Method in C#
- LinkedList Clear() Method in C#
- LinkedList Contains Method in C#
- LinkedList AddLast method in C#
- LinkedList AddBefore method in C#
- How to use removeFirst() in android ConcurrentLinkedDeque?
- How to use removeFirst() in android LinkedBlockingDeque?
- LinkedList in Java
- LinkedList in C#
- LinkedList in Arduino
- Clear LinkedList in Java

Advertisements