I find myself doing things like this all the time:
if (
SomeObject != null &&
SomeObject.Anot herObject != null &&
SomeObject.Anot herObject.YetAn other != null &&
SomeObject.Anot herObject.YetAn other.HelpMePle ase != null)
{
// Do Something
}
Surely there must be a better way that I am missing? I thought about the
using statement, but that of course depends upon the IDisposable interface
being implemented, right?
Thanks!
if (
SomeObject != null &&
SomeObject.Anot herObject != null &&
SomeObject.Anot herObject.YetAn other != null &&
SomeObject.Anot herObject.YetAn other.HelpMePle ase != null)
{
// Do Something
}
Surely there must be a better way that I am missing? I thought about the
using statement, but that of course depends upon the IDisposable interface
being implemented, right?
Thanks!
Comment