I’m trying to make a method similar to .ToString() that checks whether the object is null or not. I just done know how to make it accessible without calling the class
public class ObjectExtensions
{
public static bool IsNull(object obj)
{
bool val = false;
if (obj == null)
{ val = true; }
return val;
}
}
You’re missing the
thismodifier to make it a true extension method as well as making the object static.Then you can call it like so: