Click or drag to resize

GuardHasExactlyNElementsT Method

[This is preliminary documentation and is subject to change.]

Checks if items has exactly count number of items in its collection

Namespace:  CSInfrastructure.CodeContracts
Assembly:  CSInfrastructure (in CSInfrastructure.dll) Version: 1.13.0+Branch.master.Sha.d583fc64569355d188a9c0818d257b6d0d3e1339
Syntax
C#
public static IEnumerable<T> HasExactlyNElements<T>(
	IEnumerable<T> items,
	int count,
	string paramName,
	string message = null
)

Parameters

items
Type: System.Collections.GenericIEnumerableT
The collection to check
count
Type: SystemInt32
The exact amount of items that should be present in the collection
paramName
Type: SystemString
The name of the parameter being checked
message (Optional)
Type: SystemString
A custom message for the exception

Type Parameters

T
The type of items in the collection

Return Value

Type: IEnumerableT
The collection being checked
Exceptions
ExceptionCondition
ArgumentExceptionThrown when items has less or more than count items in its collection
See Also