- Home /
Question by
SergeantBiscuits · Jan 15, 2014 at 09:26 PM ·
objectnullfalseexists
Test if Abstract Class Exists
Hey fellas, I'm trying to implement the functionality that unity Objects have where you can test if they exist simply with
Object object = null;
if(object)... // this is read as 'false'
I've hunted down this line in the Object class:
public static implicit operator bool(Object exists);
but I don't know what it contains... any idea how I could implement this into my own classes?
Thank you!
Comment
Best Answer
Answer by MrVerdoux · Jan 15, 2014 at 09:44 PM
I think it´s as simple as this:
public static implicit operator bool(Test exists){
return exists != null;
}
Good idea by the way!