To Get List string data with IEnumerator interface using LINQ.

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

class jkExample {

static void Main(string[] args) {

List<string> listobjct = new List<string>() {
"apple","grape", "banana", "pear", "mango"};

IEnumerable<string> mydata = from string e in listobjct.AsEnumerable()
select e;

IEnumerator<string> myEnumerator = mydata.GetEnumerator();

while (myEnumerator.MoveNext()) {
Console.WriteLine("fruits are: {0}", myEnumerator.Current);


Comments or Responses

Login to post response