BinaryData Class

Definition

A lightweight abstraction for a payload of bytes that supports converting between string, stream, JSON, and bytes.

public ref class BinaryData
public class BinaryData
type BinaryData = class
Public Class BinaryData
Inheritance
BinaryData

Constructors

BinaryData(Byte[])

Creates a BinaryData instance by wrapping the provided byte array.

BinaryData(Object, JsonSerializerOptions, Type)

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

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.

Properties

Empty

Returns an empty BinaryData.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

FromBytes(Byte[])

Creates a BinaryData instance by wrapping the provided byte array.

FromBytes(ReadOnlyMemory<Byte>)

Creates a BinaryData instance by wrapping the provided ReadOnlyMemory<T>.

FromObjectAsJson<T>(T, JsonSerializerOptions)

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

FromStream(Stream)

Creates a BinaryData instance from the specified stream. The stream is not disposed by this method.

FromStreamAsync(Stream, CancellationToken)

Creates a BinaryData instance from the specified stream. The stream is not disposed by this method.

FromString(String)

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

GetHashCode()

Returns the hash code for the current BinaryData object.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToArray()

Converts the BinaryData to a byte array.

ToMemory()

Gets the value of this instance as bytes without any further interpretation.

ToObjectFromJson<T>(JsonSerializerOptions)

Converts the BinaryData to the specified type using JsonSerializer.

ToStream()

Converts the BinaryData to a read-only stream.

ToString()

Converts the value of this instance to a string using UTF-8.

Operators

Implicit(BinaryData to ReadOnlyMemory<Byte>)

Defines an implicit conversion from a BinaryData to a ReadOnlyMemory<T>.

Implicit(BinaryData to ReadOnlySpan<Byte>)

Defines an implicit conversion from a BinaryData to a ReadOnlySpan<T>.

Applies to