Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Static Public Member Functions | List of all members
Loyc.CheckParam Class Reference

Helper methods for checking argument values that throw exceptions when an argument value is not acceptable. More...


Source file:

Remarks

Helper methods for checking argument values that throw exceptions when an argument value is not acceptable.

Static Public Member Functions

static T IsNotNull< T > (string paramName, T?arg)
 
static int IsNotNegative (string argName, int value)
 
static int IsInRange (string paramName, int value, int min, int max)
 
static void ThrowOutOfRange (string argName)
 
static void ThrowOutOfRange (string argName, string message)
 
static void ThrowOutOfRange (string argName, string message, object?arg1, object?arg2=null)
 
static void ThrowOutOfRange (string argName, int value, int min, int max)
 
static void ThrowArgumentNull (string argName)
 
static void ThrowBadArgument (string message)
 
static void ThrowBadArgument (string argName, string message)
 
static void ThrowBadArgument (string argName, string message, object?arg1, object?arg2=null)
 
static int ThrowIfStartOrCountAreBelowZeroAndLimitCountIfNecessary (int start, int count, int outerCount)
 Captures a common code sequence from many slice classes. More...
 
static void Arg (string argName, [DoesNotReturnIf(false)] bool condition, object argValue)
 
static void Arg (string argName, [DoesNotReturnIf(false)] bool condition)
 

Member Function Documentation

static int Loyc.CheckParam.ThrowIfStartOrCountAreBelowZeroAndLimitCountIfNecessary ( int  start,
int  count,
int  outerCount 
)
inlinestatic

Captures a common code sequence from many slice classes.

Parameters
startStart location in the slice
countDesired length of the slice
listCountCount of the list being sliced
Returns
Returns count or, if start + count > listCount, Max(listCount - start, 0).