using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication34
{
class Program
{
static void Main(string[] args)
{
var name = new LinkedList<string>();
name.AddLast("Ali");
name.AddLast("Ahmed");
name.AddFirst("zahid");
foreach (var item in name)
{
Console.WriteLine(item);
}
Console.WriteLine("------------------------------------------------");
Console.WriteLine("Enter the name :");
string s = Console.ReadLine();
LinkedListNode<string> node = name.Find(s);
name.AddBefore(node, "sami");
name.AddAfter(node, "basit");
Console.WriteLine("------------------------------------------------");
foreach (var item in name)
{
Console.WriteLine(item);
}
}
}
}
No comments:
Post a Comment