A lightweight abstraction for a payload of bytes that supports converting between string, stream, JSON, and bytes.
public ref class BinaryData
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.BinaryDataJsonConverter))]
public class BinaryData
[<System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.BinaryDataJsonConverter))>]
type BinaryData = class
Public Class BinaryData
Determines whether the specified object is equal to the current object.
FromBytes(Byte[], String) FromBytes(Byte[])Creates a BinaryData instance by wrapping the provided byte array.
FromBytes(ReadOnlyMemory<Byte>, String) FromBytes(ReadOnlyMemory<Byte>)Creates a BinaryData instance by wrapping the provided ReadOnlyMemory<T>.
FromFile(String, String) FromFile(String) FromFileAsync(String, CancellationToken) FromFileAsync(String, String, CancellationToken) FromObjectAsJson<T>(T, JsonSerializerOptions)Creates a BinaryData instance by serializing the provided object using the JsonSerializer.
FromObjectAsJson<T>(T, JsonTypeInfo<T>)Creates a BinaryData instance by serializing the provided object using the JsonSerializer.
FromStream(Stream, String) 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.
FromStreamAsync(Stream, String, CancellationToken) FromString(String, String) 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.
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.
ToObjectFromJson<T>(JsonTypeInfo<T>)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.
WithMediaType(String) OperatorsCollaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4