using System; class Program { static void Main(string[] args) { Type t = typeof(string); Console.WriteLine(t.CanBeCastTo(typeof(object))); //True Type t1 = typeof(int); Console.WriteLine(t1.CanBeCastTo(typeof(string))); //False } }In the example above, we are checking if a string can be cast to an object which is true and if an integer can be cast to a string which is false. Package/Library: This method is part of the System namespace which is included in the .NET Framework Class Library.