NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

TargetException Constructor (String, Exception)

Initializes an instance of the TargetException class with the given message and given root cause exception.

[Visual Basic]
Overloads Public Sub New( _
   ByVal message As String, _
   ByVal inner As Exception _
)
[C#]
public TargetException(
   string message,
   Exception inner
);
[C++]
public: TargetException(
   String* message,
   Exception* inner
);
[JScript]
public function TargetException(
   message : String,
   inner : Exception
);

Parameters

message
A message that provides reasoning for why the exception occured.
inner
The exception, which is the root cause of this exception.

Remarks

A reference to an exception. When handling exceptions, it is sometimes desirable to throw another exception, one which is more indicative of the error that has occurred. In order that the original exception and the information that it carries is not lost, exceptions have a field that can hold a reference to another exception.

When handling an exception, it is sometimes helpful to have a reference to the exception(s) that caused the error to occur. You can use this constructor to create a chain of new and more meaningful exceptions with the InnerException property set to the inner exception reference. This more meaningful exception can then be thrown to the caller. Note that with this functionality it is possible to create a series of linked exceptions that terminates with the exception that was first thrown. (See Exception for more information.)

TargetException inherits from the Exception. This constructor sets the properties of the Exception object as follows:

Property Value
InnerException The inner exception.
Message The message string.

See Also

TargetException Class | TargetException Members | System.Reflection Namespace | TargetException Constructor Overload List