एक स्ट्रिंग सरणी घोषित करें।
string [] students = {"Jenifer","Angelina","Vera"}; इसे किसी लिंक्डलिस्ट में जोड़ें।
string [] students = {"Jenifer","Angelina","Vera"}; अब, अंत में एक नोड जोड़ने के लिए AddLast () विधि का उपयोग करें।
list.AddLast("Anne"); उदाहरण
using System;
using System.Collections.Generic;
class Demo {
static void Main() {
string [] students = {"Jenifer","Angelina","Vera"};
LinkedList<string> list = new LinkedList<string>(students);
foreach (var stu in list) {
Console.WriteLine(stu);
}
// add a node at the end
Console.WriteLine("Node added at the last...");
list.AddLast("Anne");
foreach (var stu in list) {
Console.WriteLine(stu);
}
}
} आउटपुट
Jenifer Angelina Vera Node added at the last... Jenifer Angelina Vera Anne