Typeof()
The type takes the Type and returns the Type of the argument.
GetType()
The GetType() method of array class in C# gets the Type of the current instance.
is
The "is" keyword is used to check if an object can be casted to a specific type. The return type of the operation is Boolean.
Example
class Demo {
}
class Program {
static void Main() {
var demo = new Demo();
Console.WriteLine($"typeof { typeof(Demo)}");
Type tp = demo.GetType();
Console.WriteLine($"GetType {tp}");
if (demo is Demo) {
System.Console.WriteLine($"is keyword check true");
}
Console.ReadLine();
}
}Output
typeof ConsoleApp.Demo GetType ConsoleApp.Demo is keyword check true