To getting array list data with IEnumerable in LINQ.

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

class jkexample {

static void Main(string[] args) {

ArrayList myarray = new ArrayList() {10, 20, 30, 40};

IEnumerable<int> myEnum = myarray.OfType<int>();

IEnumerable<int> myresult = from e in myEnum
select e;

foreach (int val in myresult) {
Console.WriteLine("data are: {0}", val);
}

Console.ReadLine();
}
}

Comments or Responses

Login to post response