
- 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
C# program to find node in Linked List
Firstly, create a new linked list −
LinkedList<string> myList = new LinkedList<string>();
Now add some elements in the linked list −
// Add 6 elements in the linked list myList.AddLast("P"); myList.AddLast("Q"); myList.AddLast("R"); myList.AddLast("S"); myList.AddLast("T"); myList.AddLast("U");
Let’s now find a node and add a new node after that −
LinkedListNode<string> node = myList.Find("R"); myList.AddAfter(node, "ADDED");
Example
You can try to run the following code to find a node in the linked list.
using System; using System.Collections.Generic; class Program { static void Main() { LinkedList<string> myList = new LinkedList<string>(); // Add 6 elements in the linked list myList.AddLast("P"); myList.AddLast("Q"); myList.AddLast("R"); myList.AddLast("S"); myList.AddLast("T"); myList.AddLast("U"); LinkedListNode<string> node = myList.Find("R"); myList.AddAfter(node, "ADDED"); foreach (var i in myList) { Console.WriteLine(i); } } }
Output
P Q R ADDED S T U
- Related Articles
- Program to find the middle node of a singly linked list in Python
- C# Program to add a node after the given node in a Linked List
- C# Program to add a node before the given node in a Linked List
- Program to find the K-th last node of a linked list in Python
- Find modular node in a linked list in C++
- C Program to reverse each node value in Singly Linked List
- Linked List Random Node in C++
- Find the largest node in Doubly linked list in C++
- Golang Program to add the first node in a given linked list.
- Golang Program to update the first node value in a linked list.
- Golang Program to update the last node value in a linked list.
- Golang Program to delete the first node from a linked list.
- Golang Program to delete the last node from a linked list.
- Python Program to Print Middle most Node of a Linked List
- Program to find linked list intersection from two linked list in Python

Advertisements