CodeCatchClause Constructors

Definition

Initializes a new instance of the CodeCatchClause class.

Overloads

CodeCatchClause()

Initializes a new instance of the CodeCatchClause class.

CodeCatchClause(String)

Initializes a new instance of the CodeCatchClause class using the specified local variable name for the exception.

CodeCatchClause(String, CodeTypeReference)

Initializes a new instance of the CodeCatchClause class using the specified local variable name for the exception and exception type.

CodeCatchClause(String, CodeTypeReference, CodeStatement[])

Initializes a new instance of the CodeCatchClause class using the specified local variable name for the exception, exception type and statement collection.

CodeCatchClause()

Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs

Initializes a new instance of the CodeCatchClause class.

C#
public CodeCatchClause();

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

CodeCatchClause(String)

Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs

Initializes a new instance of the CodeCatchClause class using the specified local variable name for the exception.

C#
public CodeCatchClause(string localName);

Parameters

localName
String

The name of the local variable declared in the catch clause for the exception. This is optional.

See also

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

CodeCatchClause(String, CodeTypeReference)

Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs

Initializes a new instance of the CodeCatchClause class using the specified local variable name for the exception and exception type.

C#
public CodeCatchClause(string localName, System.CodeDom.CodeTypeReference catchExceptionType);

Parameters

localName
String

The name of the local variable declared in the catch clause for the exception. This is optional.

catchExceptionType
CodeTypeReference

A CodeTypeReference that indicates the type of exception to catch.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

CodeCatchClause(String, CodeTypeReference, CodeStatement[])

Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs
Source:
CodeCatchClause.cs

Initializes a new instance of the CodeCatchClause class using the specified local variable name for the exception, exception type and statement collection.

C#
public CodeCatchClause(string localName, System.CodeDom.CodeTypeReference catchExceptionType, params System.CodeDom.CodeStatement[] statements);

Parameters

localName
String

The name of the local variable declared in the catch clause for the exception. This is optional.

catchExceptionType
CodeTypeReference

A CodeTypeReference that indicates the type of exception to catch.

statements
CodeStatement[]

An array of CodeStatement objects that represent the contents of the catch block.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9