共用方式為


DataServiceException 建構函式 (String, Exception)

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況的參考,初始化 DataServiceException 類別的新執行個體。

命名空間:  System.Data.Services
組件:  Microsoft.Data.Services (在 Microsoft.Data.Services.dll 中)

語法

'宣告
Public Sub New ( _
    message As String, _
    innerException As Exception _
)
'用途
Dim message As String
Dim innerException As Exception

Dim instance As New DataServiceException(message, _
    innerException)
public DataServiceException(
    string message,
    Exception innerException
)
public:
DataServiceException(
    String^ message, 
    Exception^ innerException
)
new : 
        message:string * 
        innerException:Exception -> DataServiceException
public function DataServiceException(
    message : String, 
    innerException : Exception
)

參數

  • message
    型別:System.String
    說明例外狀況的訊息。這個建構函式的呼叫端必須確保這個字串已經為目前系統的文化特性當地語系化。
  • innerException
    型別:System.Exception
    做為目前例外狀況發生原因的例外狀況。

備註

被擲回以做為前一個例外狀況直接結果的例外狀況,應該在 InnerException 屬性中包含對前一個例外狀況的參考。 InnerException 屬性會傳回與傳入建構函式中相同的值;如果 InnerException 屬性沒有提供內部例外狀況值給建構函式,則會傳回 nullnull 參考 (在 Visual Basic 中為 Nothing)。

下表顯示 DataServiceException 執行個體的初始屬性值。

屬性

InnerException

nullnull 參考 (在 Visual Basic 中為 Nothing)。

Message

message 中指定的錯誤訊息字串。

請參閱

參考

DataServiceException 類別

DataServiceException 多載

System.Data.Services 命名空間

其他資源

Handling and Throwing Exceptions