To Get List string data with IEnumerable using LINQ.

Jitendrasoft09
Posted by Jitendrasoft09 under C# category on | Points: 40 | Views : 796
using System;
using System.Collections.Generic;
using System.Linq;

class jkExample {

static void Main(string[] args) {

List<string> listobject = new List<string>() {
"apple", "Mango", "grape", "banana"};

IEnumerable<string> mydata = from e in listobject
select e;

foreach (string str in mydata) {
Console.WriteLine("Fruits are: {0}", str);
}


Console.ReadLine();
}
}

Comments or Responses

Login to post response