How to find the last element in string array that equal to specific length in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main() {
    
        string[] arr = { "c#", "java", "python", "swift", "php", "ada" };
 
        var result = Array.FindLast(arr, element => element.Length == 3);
 
        Console.Write(result);
    }
}
 
 
 
/*
run:
 
ada
 
*/

 



answered Nov 2, 2020 by avibootz
...