Use Linq OfType to get value of specific type : OfType « LINQ « C# / CSharp Tutorial






using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;

public class MainClass{
   public static void Main(){
            object[] sequence = {1, "Hello", 2.0};
            Console.Write(sequence.OfType<double>());
   }
}








22.56.OfType
22.56.1.Use Linq OfType to get value of specific type
22.56.2.OfType: select a certain type
22.56.3.prints all of the elements of an array that are of type double