System.Reflection.TargetException Class

public class TargetException : ApplicationException

Base Types

Object
  Exception
    ApplicationException
      TargetException

Assembly

mscorlib

Library

Reflection

Summary

Represents the error that occurs when an attempt is made to invoke a member on an invalid target.

Description

[Note: A TargetException is thrown when an attempt is made to invoke a non-static method using a null object. This exception can also be thrown if the target does not implement the member.]

See Also

System.Reflection Namespace

Members

TargetException Constructors

TargetException() Constructor
TargetException(System.String) Constructor
TargetException(System.String, System.Exception) Constructor


TargetException() Constructor

public TargetException();

Summary

Constructs and initializes a new instance of the TargetException class.

Description

This constructor initializes the System.Reflection.TargetException.Message property of the new instance to a system-supplied message that describes the error, such as "Instance method cannot be invoked on a null target." This message takes into account the current system culture.

The System.Reflection.TargetException.InnerException property of the new instance is initialized to null .

See Also

System.Reflection.TargetException Class, System.Reflection Namespace

TargetException(System.String) Constructor

public TargetException(string message);

Summary

Constructs and initializes a new instance of the TargetException class.

Parameters

message
A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

Description

This constructor initializes the System.Reflection.TargetException.Message property of the new instance using message. If message is null , the System.Reflection.TargetException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.

The System.Reflection.TargetException.InnerException property is initialized to null .

See Also

System.Reflection.TargetException Class, System.Reflection Namespace

TargetException(System.String, System.Exception) Constructor

public TargetException(string message, Exception inner);

Summary

Constructs and initializes a new instance of the TargetException class.

Parameters

message
A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
inner
An instance of Exception that is the cause of the current Exception. If inner is non-null, then the current Exception was raised in a catch block handling inner .

Description

This constructor initializes the System.Reflection.TargetException.Message property of the new instance using message, and the System.Reflection.TargetException.InnerException property using inner. If message is null , the System.Reflection.TargetException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.

[Note: For information on inner exceptions, see System.Exception.InnerException.]

See Also

System.Reflection.TargetException Class, System.Reflection Namespace