Table of Contents

ThrowIfDisposed Method

Definition

Namespace
Cuemon
Assemblies
Cuemon.Kernel.dll
Source
src/Cuemon.Kernel/Validator.cs

ThrowIfDisposed(bool, object, string)

Validates and throws an ObjectDisposedException if the specified condition is true.

public static void ThrowIfDisposed(bool condition, object instance, string message = "Cannot access a disposed object.")

Parameters

condition bool

The condition to evaluate.

instance object

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

message string

A message that describes the error.

Remarks

This guard should be called when performing an operation on a disposed object - not when validating arguments passed to a member.

Exceptions

ObjectDisposedException

The condition is true.

ThrowIfDisposed(bool, Type, string)

Validates and throws an ObjectDisposedException if the specified condition is true.

public static void ThrowIfDisposed(bool condition, Type type, string message = "Cannot access a disposed object.")

Parameters

condition bool

The condition to evaluate.

type Type

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

message string

A message that describes the error.

Remarks

This guard should be called when performing an operation on a disposed object - not when validating arguments passed to a member.

Exceptions

ObjectDisposedException

The condition is true.