Going forward, I will continue to post about useful extension methods that I reuse frequently. Today, I will be talking about IsNullOrEmpty and how we can use this extension method to write less code when dealing with lists.
Frequently, my service methods return lists of things (IList<T>). When these lists are returned, I check to ensure that they are not null and that they have at least one item (count > 0). After seeing this snippet duplicated throughout my code, I decided to pull it into an extension method to reduce the repetition (see
DRY).
Read more