how to check type c#
using System;
class MainClass {
public static void Main (string[] args) {
string akuma = "Messatsu";
Console.WriteLine(num.GetType());
Console.WriteLine(num);
}
}
// string
// Messatsu
how to check type c#
using System;
class MainClass {
public static void Main (string[] args) {
string akuma = "Messatsu";
Console.WriteLine(num.GetType());
Console.WriteLine(num);
}
}
// string
// Messatsu
c# typeof
string s = "Geeks";
Console.WriteLine(s.GetType());
how to check type in c#
class Animal { }
class Dog : Animal { }
void PrintTypes(Animal a) {
Console.WriteLine(a.GetType() == typeof(Animal)); // false
Console.WriteLine(a is Animal); // true
Console.WriteLine(a.GetType() == typeof(Dog)); // true
Console.WriteLine(a is Dog); // true
}
Dog spot = new Dog();
PrintTypes(spot);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us