ObjectDisposedException.ThrowIf Method

Definition

Overloads

ThrowIf(Boolean, Object)

Throws an ObjectDisposedException if the specified condition is true.

ThrowIf(Boolean, Type)

Throws an ObjectDisposedException if the specified condition is true.

ThrowIf(Boolean, Object)

Source:
ObjectDisposedException.cs
Source:
ObjectDisposedException.cs
Source:
ObjectDisposedException.cs

Throws an ObjectDisposedException if the specified condition is true.

C#
public static void ThrowIf(bool condition, object instance);

Parameters

condition
Boolean

The condition to evaluate.

instance
Object

The object whose type's full name should be included in any resulting ObjectDisposedException.

Exceptions

The condition is true.

Applies to

.NET 10 およびその他のバージョン
製品 バージョン
.NET 7, 8, 9, 10

ThrowIf(Boolean, Type)

Source:
ObjectDisposedException.cs
Source:
ObjectDisposedException.cs
Source:
ObjectDisposedException.cs

Throws an ObjectDisposedException if the specified condition is true.

C#
public static void ThrowIf(bool condition, Type type);

Parameters

condition
Boolean

The condition to evaluate.

type
Type

The type whose full name should be included in any resulting ObjectDisposedException.

Exceptions

The condition is true.

Applies to

.NET 10 およびその他のバージョン
製品 バージョン
.NET 7, 8, 9, 10