How to find the last element in string array that starts with specific character in C#

1 Answer

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

 



answered Nov 2, 2020 by avibootz
...