RandomExtensionsNextChar Method

Returns a random Char value that is within a specified range.


Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0-rc.1
public static char NextChar(
	this Random random,
	char minValue = '',
	char maxValue = ''


random  Random
The Random instance to use.
minValue  Char  (Optional)
The inclusive lower bound of the random character returned. This parameter is optional.
Default value: Char.MinValue.
maxValue  Char  (Optional)
The inclusive upper bound of the random character returned. Must be greater or equal to minValue. This parameter is optional.
Default value: Char.MaxValue.

Return Value

A Char value that is greater than or equal to minValue and less or equal to maxValue.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Random. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).


ArgumentNullExceptionrandom is .
ArgumentOutOfRangeExceptionmaxValue is less than minValue.

See Also