How to find the last occurrence of a node in LinkedList with C#

1 Answer

0 votes
using System;
using System.Collections.Generic;
                       
public class Program
{
    public static void Main()
    {
        string[] arr =  { "python", "c#", "c", "php", "nodejs", "java", "c", "c++" };
           
        LinkedList<string> ll = new LinkedList<string>(arr);
         
        LinkedListNode<string> current = ll.FindLast("c");
           
        Console.WriteLine(current.Value);
        Console.WriteLine(current.Next.Value);
    }
}
   
 
 
/*
run:
 
c
c++
 
*/

 



answered May 7, 2020 by avibootz
edited May 7, 2020 by avibootz

Related questions

1 answer 114 views
1 answer 107 views
1 answer 129 views
1 answer 93 views
...