JsonException 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| JsonException() |
初始化 JsonException 類別的新執行個體。 |
| JsonException(String) |
使用指定的錯誤訊息,初始化 JsonException 類別的新實例。 |
| JsonException(SerializationInfo, StreamingContext) |
已淘汰.
建立一個新的例外物件,包含序列化的資料。 |
| JsonException(String, Exception) |
初始化該類別的新實例 JsonException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。 |
| JsonException(String, String, Nullable<Int64>, Nullable<Int64>) |
建立一個新的例外物件,將錯誤資訊傳遞給使用者。 |
| JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception) |
建立一個新的例外物件,將包含指定內部例外的錯誤資訊傳達給使用者。 |
JsonException()
JsonException(String)
使用指定的錯誤訊息,初始化 JsonException 類別的新實例。
public:
JsonException(System::String ^ message);
public JsonException(string? message);
public JsonException(string message);
new System.Text.Json.JsonException : string -> System.Text.Json.JsonException
Public Sub New (message As String)
參數
- message
- String
情境特定的錯誤訊息。
適用於
JsonException(SerializationInfo, StreamingContext)
警告
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
建立一個新的例外物件,包含序列化的資料。
protected:
JsonException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected JsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected JsonException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Text.Json.JsonException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Text.Json.JsonException
new System.Text.Json.JsonException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Text.Json.JsonException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
參數
- info
- SerializationInfo
關於拋出例外的序列化物件資料。
- context
- StreamingContext
包含關於來源或目的地的上下文資訊的物件。
- 屬性
例外狀況
info 是 null。
適用於
JsonException(String, Exception)
初始化該類別的新實例 JsonException ,並附上指定的錯誤訊息及導致該異常的內部例外的參考。
public:
JsonException(System::String ^ message, Exception ^ innerException);
public JsonException(string? message, Exception? innerException);
public JsonException(string message, Exception innerException);
new System.Text.Json.JsonException : string * Exception -> System.Text.Json.JsonException
Public Sub New (message As String, innerException As Exception)
參數
- message
- String
情境特定的錯誤訊息。
- innerException
- Exception
就是那個例外導致了現在的例外。
適用於
JsonException(String, String, Nullable<Int64>, Nullable<Int64>)
建立一個新的例外物件,將錯誤資訊傳遞給使用者。
public:
JsonException(System::String ^ message, System::String ^ path, Nullable<long> lineNumber, Nullable<long> bytePositionInLine);
public JsonException(string? message, string? path, long? lineNumber, long? bytePositionInLine);
public JsonException(string message, string path, long? lineNumber, long? bytePositionInLine);
new System.Text.Json.JsonException : string * string * Nullable<int64> * Nullable<int64> -> System.Text.Json.JsonException
Public Sub New (message As String, path As String, lineNumber As Nullable(Of Long), bytePositionInLine As Nullable(Of Long))
參數
- message
- String
情境特定的錯誤訊息。
- path
- String
就是遇到無效 JSON 的路徑。
備註
請注意,該 bytePositionInLine 數字是位元組數(即 UTF-8 碼單位),而非字元或純量。
適用於
JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception)
建立一個新的例外物件,將包含指定內部例外的錯誤資訊傳達給使用者。
public:
JsonException(System::String ^ message, System::String ^ path, Nullable<long> lineNumber, Nullable<long> bytePositionInLine, Exception ^ innerException);
public JsonException(string? message, string? path, long? lineNumber, long? bytePositionInLine, Exception? innerException);
public JsonException(string message, string path, long? lineNumber, long? bytePositionInLine, Exception innerException);
new System.Text.Json.JsonException : string * string * Nullable<int64> * Nullable<int64> * Exception -> System.Text.Json.JsonException
Public Sub New (message As String, path As String, lineNumber As Nullable(Of Long), bytePositionInLine As Nullable(Of Long), innerException As Exception)
參數
- message
- String
情境特定的錯誤訊息。
- path
- String
就是遇到無效 JSON 的路徑。
- innerException
- Exception
就是那個例外導致了現在的例外。
備註
請注意,這些 bytePositionInLine 數字計算的是位元組數量(即 UTF-8 編碼單位),而非字元或純量。