Edit

Share via


BinaryData Constructors

Definition

Overloads

BinaryData(Byte[])

Creates a BinaryData instance by wrapping the provided byte array.

BinaryData(ReadOnlyMemory<Byte>)

Creates a BinaryData instance by wrapping the provided bytes.

BinaryData(String)

Creates a BinaryData instance from a string by converting the string to bytes using the UTF-8 encoding.

BinaryData(Byte[], String)
BinaryData(ReadOnlyMemory<Byte>, String)
BinaryData(String, String)
BinaryData(Object, JsonSerializerOptions, Type)

Creates a BinaryData instance by serializing the provided object to JSON using JsonSerializer.

BinaryData(Object, JsonSerializerContext, Type)

Creates a BinaryData instance by serializing the provided object to JSON using JsonSerializer.

BinaryData(Byte[])

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs

Creates a BinaryData instance by wrapping the provided byte array.

C#
public BinaryData(byte[] data);

Parameters

data
Byte[]

The byte array to wrap.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(ReadOnlyMemory<Byte>)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs

Creates a BinaryData instance by wrapping the provided bytes.

C#
public BinaryData(ReadOnlyMemory<byte> data);

Parameters

data
ReadOnlyMemory<Byte>

The byte data to wrap.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(String)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs

Creates a BinaryData instance from a string by converting the string to bytes using the UTF-8 encoding.

C#
public BinaryData(string data);

Parameters

data
String

The string data.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(Byte[], String)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs
C#
public BinaryData(byte[] data, string? mediaType);

Parameters

data
Byte[]
mediaType
String

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(ReadOnlyMemory<Byte>, String)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs
C#
public BinaryData(ReadOnlyMemory<byte> data, string? mediaType);

Parameters

mediaType
String

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(String, String)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs
C#
public BinaryData(string data, string? mediaType);

Parameters

data
String
mediaType
String

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(Object, JsonSerializerOptions, Type)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs

Creates a BinaryData instance by serializing the provided object to JSON using JsonSerializer.

C#
public BinaryData(object? jsonSerializable, System.Text.Json.JsonSerializerOptions? options = default, Type? type = default);

Parameters

jsonSerializable
Object

The object to serialize to JSON using JsonSerializer.

options
JsonSerializerOptions

The options to use when serializing to JSON.

type
Type

The type to use when serializing the data. If not specified, GetType() will be used to determine the type.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

BinaryData(Object, JsonSerializerContext, Type)

Source:
BinaryData.cs
Source:
BinaryData.cs
Source:
BinaryData.cs

Creates a BinaryData instance by serializing the provided object to JSON using JsonSerializer.

C#
public BinaryData(object? jsonSerializable, System.Text.Json.Serialization.JsonSerializerContext context, Type? type = default);

Parameters

jsonSerializable
Object

The object that will be serialized to JSON using JsonSerializer.

context
JsonSerializerContext

The JsonSerializerContext to use when serializing to JSON.

type
Type

The type to use when serializing the data. If not specified, GetType() will be used to determine the type.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)