ThrowIfSequenceEmpty Method
Definition
ThrowIfSequenceEmpty<T>(IEnumerable<T>, string, string)
Validates and throws an ArgumentException if the specified argument has no elements.
public static void ThrowIfSequenceEmpty<T>(IEnumerable<T> argument, string message = "Value 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
Remarks
This method will not throw an exception if argument is null.
Exceptions
- ArgumentException
argumentcontains no elements.