I have the following code:
IList<object> testList = null;
...
if (testList != null) // <- how to get rid of this check?
{
foreach (var item in testList)
{
//Do stuff.
}
}
Is there a way to avoid the if
before the foreach
? I saw a few solutions but when using List
, is there any solution when using IList
?