ThrowIfSequenceNullOrEmpty Method
Definition
ThrowIfSequenceNullOrEmpty<T>(IEnumerable<T>, string, string)
Validates and throws either an ArgumentNullException or ArgumentException if the specified argument is respectively null or has no elements.
public static void ThrowIfSequenceNullOrEmpty<T>(IEnumerable<T> argument, string message = "Value is either null or contains no elements.", string paramName = null)
Parameters
argumentIEnumerable<T>The value to be evaluated.
messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Type Parameters
T
Exceptions
- ArgumentNullException
argumentcannot be null.- ArgumentException
argumentcontains no elements.