BinaryData 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| BinaryData(Byte[]) |
透過包裝提供的位元組陣列來建立 BinaryData 實例。 |
| BinaryData(ReadOnlyMemory<Byte>) |
透過包裝提供的位元組來建立實 BinaryData 例。 |
| BinaryData(String) |
透過使用 UTF-8 編碼將字串轉換為位元組,從字串建立 BinaryData 實例。 |
| BinaryData(Byte[], String) |
透過包裝提供的位元組陣列建立 BinaryData 實例,並設定 MediaType 為 <pref=“mediaType”></see> value。 |
| BinaryData(ReadOnlyMemory<Byte>, String) |
BinaryData透過包裝提供的位元組建立實例,並設定MediaType為 <pref=“mediaType”></see> 值。 |
| BinaryData(String, String) |
透過使用 UTF-8 編碼將字串轉換為位元組,從字串建立 BinaryData 實例,並設定 MediaType 為 <pref=“mediaType”></see> 值。 |
| BinaryData(Object, JsonSerializerOptions, Type) |
透過將JsonSerializer提供的物件序列化成 JSON 來建立BinaryData實例。 |
| BinaryData(Object, JsonSerializerContext, Type) |
透過將JsonSerializer提供的物件序列化成 JSON 來建立BinaryData實例。 |
BinaryData(Byte[])
透過包裝提供的位元組陣列來建立 BinaryData 實例。
public:
BinaryData(cli::array <System::Byte> ^ data);
public BinaryData(byte[] data);
new BinaryData : byte[] -> BinaryData
Public Sub New (data As Byte())
參數
- data
- Byte[]
要包裝的位元組陣列。
適用於
BinaryData(ReadOnlyMemory<Byte>)
透過包裝提供的位元組來建立實 BinaryData 例。
public:
BinaryData(ReadOnlyMemory<System::Byte> data);
public BinaryData(ReadOnlyMemory<byte> data);
new BinaryData : ReadOnlyMemory<byte> -> BinaryData
Public Sub New (data As ReadOnlyMemory(Of Byte))
參數
- data
- ReadOnlyMemory<Byte>
要包裝的位元組資料。
適用於
BinaryData(String)
透過使用 UTF-8 編碼將字串轉換為位元組,從字串建立 BinaryData 實例。
public:
BinaryData(System::String ^ data);
public BinaryData(string data);
new BinaryData : string -> BinaryData
Public Sub New (data As String)
參數
- data
- String
字串資料。
適用於
BinaryData(Byte[], String)
透過包裝提供的位元組陣列建立 BinaryData 實例,並設定 MediaType 為 <pref=“mediaType”></see> value。
public:
BinaryData(cli::array <System::Byte> ^ data, System::String ^ mediaType);
public BinaryData(byte[] data, string? mediaType);
new BinaryData : byte[] * string -> BinaryData
Public Sub New (data As Byte(), mediaType As String)
參數
- data
- Byte[]
陣列要包裹。
另請參閱
適用於
BinaryData(ReadOnlyMemory<Byte>, String)
BinaryData透過包裝提供的位元組建立實例,並設定MediaType為 <pref=“mediaType”></see> 值。
public:
BinaryData(ReadOnlyMemory<System::Byte> data, System::String ^ mediaType);
public BinaryData(ReadOnlyMemory<byte> data, string? mediaType);
new BinaryData : ReadOnlyMemory<byte> * string -> BinaryData
Public Sub New (data As ReadOnlyMemory(Of Byte), mediaType As String)
參數
- data
- ReadOnlyMemory<Byte>
要封裝的位元組資料。
另請參閱
適用於
BinaryData(String, String)
透過使用 UTF-8 編碼將字串轉換為位元組,從字串建立 BinaryData 實例,並設定 MediaType 為 <pref=“mediaType”></see> 值。
public:
BinaryData(System::String ^ data, System::String ^ mediaType);
public BinaryData(string data, string? mediaType);
new BinaryData : string * string -> BinaryData
Public Sub New (data As String, mediaType As String)
參數
- data
- String
字串資料。
另請參閱
適用於
BinaryData(Object, JsonSerializerOptions, Type)
透過將JsonSerializer提供的物件序列化成 JSON 來建立BinaryData實例。
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")]
public BinaryData(object? jsonSerializable, System.Text.Json.JsonSerializerOptions? options = default, Type? type = default);
public BinaryData(object? jsonSerializable, System.Text.Json.JsonSerializerOptions? options = default, Type? type = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")>]
new BinaryData : obj * System.Text.Json.JsonSerializerOptions * Type -> BinaryData
new BinaryData : obj * System.Text.Json.JsonSerializerOptions * Type -> BinaryData
Public Sub New (jsonSerializable As Object, Optional options As JsonSerializerOptions = Nothing, Optional type As Type = Nothing)
參數
- jsonSerializable
- Object
用來序列化成 JSON JsonSerializer的物件。
- options
- JsonSerializerOptions
序列化成 JSON 時可以使用的選項。
- 屬性
另請參閱
適用於
BinaryData(Object, JsonSerializerContext, Type)
透過將JsonSerializer提供的物件序列化成 JSON 來建立BinaryData實例。
public BinaryData(object? jsonSerializable, System.Text.Json.Serialization.JsonSerializerContext context, Type? type = default);
new BinaryData : obj * System.Text.Json.Serialization.JsonSerializerContext * Type -> BinaryData
Public Sub New (jsonSerializable As Object, context As JsonSerializerContext, Optional type As Type = Nothing)
參數
- jsonSerializable
- Object
將用 S 序列化成 JSON JsonSerializer的物件。
- context
- JsonSerializerContext
序列化成 JSON 時要用的。JsonSerializerContext