Language Integrated Query (LINQ) Question:
Download Questions PDF

What is “OfType” in linq?

Answer:

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

Download LINQ Interview Questions And Answers PDF

Previous QuestionNext Question
How can you find average of student marks from student tables (Columns are StudentID, Marks)?How can we find Sequence of Items in two different array (same Type) in the same order using linq query?