Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Singly LinkedList Traversal using C#
Declare a LinkedList using the LinkedList collection in X# −
var a = new LinkedList < string > ();
Now add elements to the LinkedList −
a.AddLast("Tim");
a.AddLast("Tom");
Let us see how to perform traversal in a LinkedList −
Example
using System;
using System.Collections.Generic;
public class Demo {
public static void Main(string[] args) {
var a = new LinkedList < string > ();
a.AddLast("Tim");
a.AddLast("Tom");
foreach(var res in a) {
Console.WriteLine(res);
}
}
}Advertisements