
- 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 Remove method in C#
Use the Remove() method to remove the first occurrence of a node in a LinkedList.
Firstly, let us set a LinkedList with integer elements.
int [] num = {2, 5, 7, 15}; LinkedList<int> list = new LinkedList<int>(num);
Now, let’s say you need to remove node with element 7. For that, use the Remove() method.
list.Remove(7);
Let us see the complete code.
Example
using System; using System.Collections.Generic; class Demo { static void Main() { int [] num = {2, 5, 7, 15}; LinkedList<int> list = new LinkedList<int>(num); foreach (var n in list) { Console.WriteLine(n); } // adding a node at the end var newNode = list.AddLast(25); Console.WriteLine("LinkedList after adding new nodes..."); foreach (var n in list) { Console.WriteLine(n); } // removing list.Remove(7); Console.WriteLine("LinkedList after removing a node..."); foreach (var n in list) { Console.WriteLine(n); } } }
Output
2 5 7 15 LinkedList after adding new nodes... 2 5 7 15 25 LinkedList after removing a node... 2 5 15 25
- Related Articles
- LinkedList AddFirst method in C#
- LinkedList AddAfter method in C#
- LinkedList RemoveFirst() 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#
- LinkedList in C#
- Remove a specific element from a LinkedList in Java
- Java Program to Remove elements from the LinkedList
- Remove a range of elements from a LinkedList in Java
- How to remove an element from ArrayList or, LinkedList in Java?
- Removing all nodes from LinkedList in C#
- Singly LinkedList Traversal using C#

Advertisements