26 instantiations of BinaryData
AzureContainerApps.ApiService (1)
Program.cs (1)
45await container.UploadBlobAsync(blobNameAndContent, new BinaryData(blobNameAndContent));
AzureFunctionsEndToEnd.ApiService (2)
Program.cs (2)
47await blob.UploadAsync(new BinaryData(entry)); 54var data = new BinaryData(Encoding.UTF8.GetBytes(RandomString(length)));
AzureStorageEndToEnd.ApiService (1)
Program.cs (1)
23await container.UploadBlobAsync(blobNameAndContent, new BinaryData(blobNameAndContent));
BicepSample.ApiService (3)
Program.cs (3)
128await blob.UploadAsync(new BinaryData(entry)); 175await queue.SendMessageAsync(new BinaryData(entry), cancellationToken: cancellationToken); 194await sender.SendMessageAsync(new ServiceBusMessage(new BinaryData(entry)), cancellationToken);
CdkSample.ApiService (1)
Program.cs (1)
93await container.UploadBlobAsync(blobNameAndContent, new BinaryData(blobNameAndContent));
Microsoft.Extensions.AI.AzureAIInference (3)
AzureAIInferenceChatClient.cs (2)
315result.AdditionalProperties["top_k"] = new BinaryData(JsonSerializer.SerializeToUtf8Bytes(topK, AIJsonUtilities.DefaultOptions.GetTypeInfo(typeof(int)))); 329result.AdditionalProperties[prop.Key] = new BinaryData(data);
AzureAIInferenceEmbeddingGenerator.cs (1)
177result.AdditionalProperties[prop.Key] = new BinaryData(data);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIChatClient.cs (1)
629new(JsonSerializer.SerializeToUtf8Bytes(
OpenAIRealtimeExtensions.cs (1)
46Parameters = new BinaryData(JsonSerializer.SerializeToUtf8Bytes(
System.Memory.Data (13)
System\BinaryData.cs (13)
35public static BinaryData Empty { get; } = new BinaryData(ReadOnlyMemory<byte>.Empty); 169public static BinaryData FromBytes(ReadOnlyMemory<byte> data) => new BinaryData(data); 181=> new BinaryData(data, mediaType); 189public static BinaryData FromBytes(byte[] data) => new BinaryData(data); 200=> new BinaryData(data, mediaType); 208public static BinaryData FromString(string data) => new BinaryData(data); 220=> new BinaryData(data, mediaType); 314return new BinaryData(memoryStream.GetBuffer().AsMemory(0, (int)memoryStream.Position), mediaType); 340return new BinaryData(File.ReadAllBytes(path), mediaType); 374return new BinaryData( 397=> new BinaryData(JsonSerializer.SerializeToUtf8Bytes(jsonSerializable, options), MediaTypeApplicationJson); 410=> new BinaryData(JsonSerializer.SerializeToUtf8Bytes(jsonSerializable, jsonTypeInfo), MediaTypeApplicationJson); 419=> new BinaryData(_bytes, mediaType);
78 references to BinaryData
Aspire.Hosting.Azure (2)
Provisioning\Provisioners\BicepProvisioner.cs (2)
237Template = BinaryData.FromString(armTemplateContents.ToString()), 238Parameters = BinaryData.FromObjectAsJson(parameters),
Aspire.Hosting.Azure.Tests (1)
AzureStorageEmulatorFunctionalTests.cs (1)
88await blobClient.UploadAsync(BinaryData.FromString("testValue"));
AzureFunctionsEndToEnd.ApiService (1)
Program.cs (1)
54var data = new BinaryData(Encoding.UTF8.GetBytes(RandomString(length)));
EventHubsApi (4)
Program.cs (4)
17var binaryData = BinaryData.FromString("Hello, from /test sent via producerClient"); 24var binaryData = await BinaryData.FromStreamAsync(body);
Microsoft.Extensions.AI.AzureAIInference (5)
AzureAIChatToolJson.cs (1)
15public static BinaryData ZeroFunctionParametersSchema { get; } = new("""{"type":"object","required":[],"properties":{}}"""u8.ToArray());
AzureAIInferenceChatClient.cs (3)
377BinaryData resultParameters = AzureAIChatToolJson.ZeroFunctionParametersSchema; 396resultParameters = BinaryData.FromBytes( 482parts.Add(new ChatMessageImageContentItem(BinaryData.FromBytes(data), imageContent.MediaType));
AzureAIInferenceEmbeddingGenerator.cs (1)
117private static float[] ParseBase64Floats(BinaryData binaryData)
Microsoft.Extensions.AI.OpenAI (6)
OpenAIChatClient.cs (6)
482OpenAI.Chat.ChatResponseFormat.CreateJsonSchemaFormat(jsonFormat.SchemaName ?? "json_schema", BinaryData.FromString(jsonSchema), jsonFormat.SchemaDescription) : 498BinaryData resultParameters = OpenAIChatToolJson.ZeroFunctionParametersSchema; 515resultParameters = BinaryData.FromBytes( 526public static BinaryData ZeroFunctionParametersSchema { get; } = new("""{"type":"object","required":[],"properties":{}}"""u8.ToArray()); 658parts.Add(ChatMessageContentPart.CreateImagePart(BinaryData.FromBytes(data), imageContent.MediaType)); 680private static FunctionCallContent ParseCallContentFromBinaryData(BinaryData ut8Json, string callId, string name) =>
System.Memory.Data (59)
System\BinaryData.cs (54)
28/// The backing store for the <see cref="BinaryData"/> instance. 35public static BinaryData Empty { get; } = new BinaryData(ReadOnlyMemory<byte>.Empty); 56/// Creates a <see cref="BinaryData"/> instance by wrapping the 66/// Creates a <see cref="BinaryData"/> instance by wrapping the provided byte array 78/// Creates a <see cref="BinaryData"/> instance by serializing the provided object to JSON 97/// Creates a <see cref="BinaryData"/> instance by serializing the provided object to JSON 114/// Creates a <see cref="BinaryData"/> instance by wrapping the 124/// Creates a <see cref="BinaryData"/> instance by wrapping the provided bytes 136/// Creates a <see cref="BinaryData"/> instance from a string by converting 151/// Creates a <see cref="BinaryData"/> instance from a string by converting 164/// Creates a <see cref="BinaryData"/> instance by wrapping the provided 169public static BinaryData FromBytes(ReadOnlyMemory<byte> data) => new BinaryData(data); 172/// Creates a <see cref="BinaryData"/> instance by wrapping the provided 180public static BinaryData FromBytes(ReadOnlyMemory<byte> data, string? mediaType) 184/// Creates a <see cref="BinaryData"/> instance by wrapping the provided 189public static BinaryData FromBytes(byte[] data) => new BinaryData(data); 192/// Creates a <see cref="BinaryData"/> instance by wrapping the provided byte array 199public static BinaryData FromBytes(byte[] data, string? mediaType) 203/// Creates a <see cref="BinaryData"/> instance from a string by converting 208public static BinaryData FromString(string data) => new BinaryData(data); 211/// Creates a <see cref="BinaryData"/> instance from a string by converting 219public static BinaryData FromString(string data, string? mediaType) 223/// Creates a <see cref="BinaryData"/> instance from the specified stream. 228public static BinaryData FromStream(Stream stream) => FromStream(stream, mediaType: null); 231/// Creates a <see cref="BinaryData"/> instance from the specified stream 239public static BinaryData FromStream(Stream stream, string? mediaType) 250/// Creates a <see cref="BinaryData"/> instance from the specified stream. 256public static Task<BinaryData> FromStreamAsync(Stream stream, CancellationToken cancellationToken = default) 260/// Creates a <see cref="BinaryData"/> instance from the specified stream 269public static Task<BinaryData> FromStreamAsync(Stream stream, string? mediaType, 280private static async Task<BinaryData> FromStreamAsync(Stream stream, bool useAsync, 319/// Creates a <see cref="BinaryData"/> instance from the specified file. 323public static BinaryData FromFile(string path) => FromFile(path, mediaType: null); 326/// Creates a <see cref="BinaryData"/> instance from the specified file 333public static BinaryData FromFile(string path, string? mediaType) 344/// Creates a <see cref="BinaryData"/> instance from the specified file. 349public static Task<BinaryData> FromFileAsync(string path, CancellationToken cancellationToken = default) 353/// Creates a <see cref="BinaryData"/> instance from the specified file 361public static Task<BinaryData> FromFileAsync(string path, string? mediaType, 371async Task<BinaryData> Core() 385/// Creates a <see cref="BinaryData"/> instance by serializing the provided object using 396public static BinaryData FromObjectAsJson<T>(T jsonSerializable, JsonSerializerOptions? options = default) 400/// Creates a <see cref="BinaryData"/> instance by serializing the provided object using 409public static BinaryData FromObjectAsJson<T>(T jsonSerializable, JsonTypeInfo<T> jsonTypeInfo) 413/// Creates a <see cref="BinaryData"/> instance by wrapping the same data 418public BinaryData WithMediaType(string? mediaType) 450/// Converts the <see cref="BinaryData"/> to a read-only stream. 462/// Converts the <see cref="BinaryData"/> to a byte array. 468/// Converts the <see cref="BinaryData"/> to the specified type using 481/// Converts the <see cref="BinaryData"/> to the specified type using 503/// Defines an implicit conversion from a <see cref="BinaryData" /> to a <see cref="ReadOnlyMemory{Byte}"/>. 506public static implicit operator ReadOnlyMemory<byte>(BinaryData? data) => data?._bytes ?? default; 509/// Defines an implicit conversion from a <see cref="BinaryData" /> to a <see cref="ReadOnlySpan{Byte}"/>. 512public static implicit operator ReadOnlySpan<byte>(BinaryData? data)
System\BinaryDataConverter.cs (5)
7/// Serializes <see cref="BinaryData"/> instances as Base64 JSON strings. 9public sealed class BinaryDataJsonConverter : JsonConverter<BinaryData> 18public override BinaryData? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) 20return BinaryData.FromBytes(reader.GetBytesFromBase64()); 24public override void Write(Utf8JsonWriter writer, BinaryData value, JsonSerializerOptions options)