單項(xiàng)選擇題

您要寫下面的名為 CustomException的自定義異常類public class CustomException : ApplicationException { public static int COR_E_ARGUMENT = unchecked((int)0x80070057); public CustomException(string msg) : base(msg) { HResult = COR_E_ARGUMENT; }}您需要編寫一段代碼,這段代碼要使用ustomException 類,并且要迅速返回控制權(quán)給COM 調(diào)用方法。 您應(yīng)該使用哪個(gè)代碼?()

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”);

微信掃碼免費(fèi)搜題