CSharp - Use condition with Count operator

Description

Use condition with Count operator

Demo

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
class Program//from   ww  w.j av a  2  s. c o m
{
    static void Main(string[] args)
    {
        string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"};
        
        int count = codeNames.Count(s => s.StartsWith("J"));
        Console.WriteLine(count);
    }
}

Result

Related Topic