Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​ArgumentOutOfRangeException

Assembly: System.Runtime

Inheritance: object → ExceptionSystemExceptionArgumentException → ArgumentOutOfRangeException

Implemented Interfaces

The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.

Properties

public object
ActualValue
Gets the argument value that causes this exception.
public string
Message
Gets the error message and the string representation of the invalid argument value, or only the error message if the argument value is null.
public string
ParamName
Gets the name of the parameter that causes this exception.
public IDictionary
Data
Gets a collection of key/value pairs that provide additional user-defined information about the exception.
public string
HelpLink
Gets or sets a link to the help file associated with this exception.
public int
HResult
Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
public Exception
InnerException
Gets the <see cref="T:System.Exception" /> instance that caused the current exception.
public string
Source
Gets or sets the name of the application or the object that causes the error.
public string
StackTrace
Gets a string representation of the immediate frames on the call stack.
public MethodBase
TargetSite
Gets the method that throws the current exception.

Methods

public void
GetObjectData​(SerializationInfo info, StreamingContext context)
Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the invalid argument value and additional exception information.
info The object that holds the serialized object data.
context An object that describes the source or destination of the serialized data.
public static void
ThrowIfEqual​(T value, T other, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is equal to <paramref name="other" /> .
value The argument to validate as not equal to <paramref name="other" /> .
other The value to compare with <paramref name="value" /> .
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfGreaterThanOrEqual​(T value, T other, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is greater than or equal to <paramref name="other" /> .
value The argument to validate as less than <paramref name="other" /> .
other The value to compare with <paramref name="value" /> .
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfGreaterThan​(T value, T other, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is greater than <paramref name="other" /> .
value The argument to validate as less than or equal to <paramref name="other" /> .
other The value to compare with <paramref name="value" /> .
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfLessThanOrEqual​(T value, T other, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is less than or equal to <paramref name="other" /> .
value The argument to validate as greater than <paramref name="other" /> .
other The value to compare with <paramref name="value" /> .
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfLessThan​(T value, T other, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is less than <paramref name="other" /> .
value The argument to validate as greater than or equal to <paramref name="other" /> .
other The value to compare with <paramref name="value" /> .
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfNegativeOrZero​(T value, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is negative or zero.
value The argument to validate as non-zero and non-negative.
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfNegative​(T value, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is negative.
value The argument to validate as non-negative.
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfNotEqual​(T value, T other, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is not equal to <paramref name="other" /> .
value The argument to validate as equal to <paramref name="other" /> .
other The value to compare with <paramref name="value" /> .
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public static void
ThrowIfZero​(T value, string paramName = null)
Throws an <see cref="T:System.ArgumentOutOfRangeException" /> if <paramref name="value" /> is zero.
value The argument to validate as non-zero.
paramName The name of the parameter with which <paramref name="value" /> corresponds.
public Exception
GetBaseException​()
Inherited from Exception
When overridden in a derived class, returns the <see cref="T:System.Exception" /> that is the root cause of one or more subsequent exceptions.
Returns The first exception thrown in a chain of exceptions. If the <see cref="P:System.Exception.InnerException" /> property of the current exception is a null reference ( <see langword="Nothing" /> in Visual Basic), this property returns the current exception.
public Type
GetType​()
Inherited from Exception
Gets the runtime type of the current instance.
Returns A <see cref="T:System.Type" /> object that represents the exact runtime type of the current instance.
public string
ToString​()
Inherited from Exception
Creates and returns a string representation of the current exception.
Returns A string representation of the current exception.
public bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .