public static void EnsureMoreThanZeroElements <T>( this IEnumerable <T> collection, string checkedVariableName, [CallerMemberName] string callerMethod = "") { if (string.IsNullOrEmpty(callerMethod)) { callerMethod = "Unknown"; } // Get the collection count var hasAnyElement = SeeingSharpUtil.HasAnyElement(collection); // Check result if (!hasAnyElement) { throw new SeeingSharpCheckException( $"Collection {checkedVariableName} within method {callerMethod} musst have more than zero elements!"); } }