public class TargetException : ApplicationException
Object
Exception
ApplicationException
TargetException
mscorlib
Reflection
Represents the error that occurs when an attempt is made to invoke a member on an invalid target.
[Note: A TargetException is thrown when an attempt is made to invoke a non-static method using anull
object. This exception can also be thrown if the target does not implement the member.]
System.Reflection Namespace
TargetException Constructors
TargetException() Constructor
TargetException(System.String) Constructor
TargetException(System.String, System.Exception) Constructor
public TargetException();
Constructs and initializes a new instance of the TargetException class.
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
.
System.Reflection.TargetException Class, System.Reflection Namespace
public TargetException(string message);
Constructs and initializes a new instance of the TargetException class.
- 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.
This constructor initializes the System.Reflection.TargetException.Message property of the new instance using message. If message isnull
, 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
.
System.Reflection.TargetException Class, System.Reflection Namespace
public TargetException(string message, Exception inner);
Constructs and initializes a new instance of the TargetException class.
- 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 .
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 isnull
, 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.]
System.Reflection.TargetException Class, System.Reflection Namespace