Share via


JsonException 建構函式

定義

多載

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.cs
來源:
JsonException.cs
來源:
JsonException.cs

初始化 JsonException 類別的新執行個體。

public:
 JsonException();
public JsonException ();
Public Sub New ()

適用於

JsonException(String)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs

使用指定的錯誤訊息,初始化 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)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs

警告

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);
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);
new System.Text.Json.JsonException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Text.Json.JsonException
[<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
Protected Sub New (info As SerializationInfo, context As StreamingContext)

參數

info
SerializationInfo

擲回例外狀況相關的序列化物件資料。

context
StreamingContext

物件,包含關於來源或目的端的內容資訊。

屬性

例外狀況

infonull

適用於

JsonException(String, Exception)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs

使用指定的錯誤訊息以及造成此例外狀況的內部例外狀況參考,以初始化 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>)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs

建立新的例外狀況物件,將錯誤資訊轉送給使用者。

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 所在的路徑。

lineNumber
Nullable<Int64>

還原序列化時發現無效 JSON 處的行號 (從 0 開始)。

bytePositionInLine
Nullable<Int64>

發現無效 JSON 所在的目前這一行內位元組計數 (從 0 開始)。

備註

請注意, bytePositionInLine 計算 (位元組數目,也就是 UTF-8 程式碼單位) ,而不是字元或純量。

適用於

JsonException(String, String, Nullable<Int64>, Nullable<Int64>, Exception)

來源:
JsonException.cs
來源:
JsonException.cs
來源:
JsonException.cs

建立新的例外狀況物件,將錯誤資訊轉送給使用者,包括指定的內部例外狀況。

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 所在的路徑。

lineNumber
Nullable<Int64>

還原序列化時發現無效 JSON 處的行號 (從 0 開始)。

bytePositionInLine
Nullable<Int64>

發現無效 JSON 所在的目前這一行內位元組計數 (從 0 開始)。

innerException
Exception

造成目前例外狀況的例外狀況。

備註

請注意,會 bytePositionInLine 計算 (的位元組數目,也就是 UTF-8 程式碼單位) ,而不是字元或純量。

適用於