You write the following custom exception class named CustomException.

You write the following custom exception class named CustomException.
Public Class CustomException
Inherits ApplicationException
Public Shared COR_E_ARGUMENT As Int32 = &H80070057
Public Sub New(ByVal strMessage As String)
MyBase.New(strMessage)
HResult = COR_E_ARGUMENT
End SubEnd Class
You need to write a code segment that will use the CustomException class to immediately return
control to the COM caller. You also need to ensure that the caller has access to the error code.
Which code segment should you use?


A. Return Marshal.GetExceptionForHR( _
    CustomException.COR_E_ARGUMENT)
B. Return CustomException.COR_E_ARGUMENT
C. Marshal.ThrowExceptionForHR( _
    CustomException.COR_E_ARGUMENT)
D. Throw New CustomException("Argument is out of bounds") 


Answer: D

No comments:

Post a Comment