⟩ What is “OfType” in linq?
public void TypeofExa()
{
Var numbers = {null,1.0,"two", 3,"four",5,"six",7.0 };
var doubles = from n in numbers where n is doublen;
Console.WriteLine("Numbers stored as doubles:");
foreach (object d in doubles)
{
Console.WriteLine(d);
}
}
Output:
Numbers stored as doubles:
1
7