/opensource/extensions/system.collections/collection/IsNullOrEmpty.cs
C# | 25 lines | 15 code | 2 blank | 8 comment | 3 complexity | b9e9c80fbe9d047dddd7220ab25d1ee5 MD5 | raw file
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
-
- namespace zielonka.co.uk.extensions.system.collections
- {
- /*
- Works with collections and arrays:
-
- bool isNullOrEmpty = array.IsNullOrEmpty()
- instead of
-
- bool isNullOrEmpty = array == null || array.Length == 0;
- */
-
- public static partial class CollectionExtensions
- {
- public static bool IsNullOrEmpty(this ICollection obj)
- {
- return (obj == null || obj.Count == 0);
- }
- }
- }