ধরা যাক, পূর্ণসংখ্যা নোড সহ আমাদের লিঙ্কডলিস্ট হল নিম্নোক্ত।
int [] num = {29, 40, 67, 89, 198, 234};
LinkedList<int> myList = new LinkedList<int>(num); এখন, আপনি যদি তালিকা থেকে প্রথম উপাদানটি সরাতে চান, তাহলে RemoveFirst() পদ্ধতি ব্যবহার করুন।
myList.RemoveFirst();
উদাহরণ
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);
}
}
} আউটপুট
29 40 67 89 198 234 LinkedList after removing the first node... 40 67 89 198 234