Select from a collection - CSharp LINQ

CSharp examples for LINQ:Select

Description

Select from a collection

Demo Code


using System;//from  ww w  .  j  a v  a 2 s .  c o m
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Data;

class MainClass
    {
        static void Main(string[] args)
        {
            ICollection<string> collection = new List<string>() { "Oracle", "MySQL", "C", "fig", "XML", "file", "PLSQL" };
            IEnumerable<string> collEnum = from e in collection select e;
            foreach (string str in collEnum)
            {
                Console.WriteLine("Element {0}", str);
            }
   }
}

Result


Related Tutorials