How to filter data of a particular type in ArrayList?

Ddd
Posted by Ddd under C# category on | Points: 40 | Views : 4128
using System;
using System.Linq;
using System.Text;
using System.Collections;
class Class4
{
static void Main()
{
//Filter integer values from an arraylist
//Use the OfType function
ArrayList t = new ArrayList();
t.Add("one");
t.Add(300);
t.Add(100);
t.Add(345.55);
var q = t.OfType<int>();
foreach (var z in q)
{
Console.WriteLine(z);
}
}
}

Comments or Responses

Login to post response