Question about C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Question about C#

which operator determines whether an object is an instance of the given type in C sharp

2nd Apr 2018, 7:14 PM
Muhammad Irfan ✓
Muhammad Irfan ✓ - avatar
1 Answer
+ 1
If your are talking about just operators it should be the "is"-operator. if (spot is Dog) To do type checking you also can use GetType() together with Typeof() if (spot.GetType() == typeof(Dog)) https://code.sololearn.com/cqT0PDpCtkhm https://stackoverflow.com/questions/983030/type-checking-typeof-gettype-or-is
3rd Apr 2018, 7:50 PM
sneeze
sneeze - avatar