DEV Community 👩‍💻👨‍💻

Discussion on: The perfect non-null test

ahmaddeel profile image

Is object different from struct? What if we have struct and "is object" fails?

peledzohar profile image
Zohar Peled Author

object is the ultimate base type for all .Net types. structs implicitly inherits the ValueType class which inherits object, and by definition are value types, meaning they can't be null to begin with - which means that this test will always return true.