CSharp - LINQ to Objects Query

Introduction

IEnumerable<T> is an interface that all the C# generic collection classes implement.

This interface permits the enumeration of a collection's elements.

Demo

using System;  
using System.Linq;  
class Program//from  www .j  a va  2 s  . c o m
{
    static void Main(string[] args)
    {
        string[] names = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"};  
          
        string president = names.Where(p => p.StartsWith("J")).First();  
          
        Console.WriteLine(president);  

    }
}

Result

Related Topic