- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the C# equivalent to Java's isInstance()?
The java.lang.Class.isInstance() determines if the specified Object is assignment-compatible with the object represented by this Class
Java’s isInstance() method’s equivalent in C# is IsAssignableFrom().
Another simplest way for isInstance() equivalent is −
bool res = (ob is DemoClass);
You can also work with Type.IsInstanceOfType for the same result −
ob.GetType().IsInstanceOfType(otherOb)
Advertisements