DuplicateKeyException Constructors

Definition

Initializes a new instance of the DuplicateKeyException class.

Overloads

DuplicateKeyException(Object)

Initializes a new instance of the DuplicateKeyException class.

DuplicateKeyException(Object, String)

Initializes a new instance of the DuplicateKeyException class by referencing the duplicate key and providing an error message.

DuplicateKeyException(Object, String, Exception)

Initializes a new instance of the DuplicateKeyException class by referencing the duplicate key, providing an error message, and specifying the exception that caused this exception to be thrown.

DuplicateKeyException(Object)

Initializes a new instance of the DuplicateKeyException class.

C#
public DuplicateKeyException(object duplicate);

Parameters

duplicate
Object

The duplicate key that caused the exception to be thrown.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

DuplicateKeyException(Object, String)

Initializes a new instance of the DuplicateKeyException class by referencing the duplicate key and providing an error message.

C#
public DuplicateKeyException(object duplicate, string message);

Parameters

duplicate
Object

The duplicate key that caused the exception to be thrown.

message
String

The message to appear when the exception is thrown.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

DuplicateKeyException(Object, String, Exception)

Initializes a new instance of the DuplicateKeyException class by referencing the duplicate key, providing an error message, and specifying the exception that caused this exception to be thrown.

C#
public DuplicateKeyException(object duplicate, string message, Exception innerException);

Parameters

duplicate
Object

The duplicate key that caused the exception to be thrown.

message
String

The message to appear when the exception is thrown.

innerException
Exception

The previous exception that caused the DuplicateKeyException exception to be thrown.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1