From 4bbbed0001501669381a96870e19223ce3791f4a Mon Sep 17 00:00:00 2001 From: dhruv Date: Sat, 1 Aug 2026 21:55:52 +0530 Subject: [PATCH] dotnet: update README attachment examples to use AttachmentFile/AttachmentBlob; fix Session example (fixes #2196 --- dotnet/README.md | 15 +++++++-------- dotnet/src/Session.cs | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dotnet/README.md b/dotnet/README.md index 1971c2107b..8c0e01e9e5 100644 --- a/dotnet/README.md +++ b/dotnet/README.md @@ -296,9 +296,9 @@ The SDK supports image attachments via the `Attachments` parameter. You can atta await session.SendAsync(new MessageOptions { Prompt = "What's in this image?", - Attachments = new List + Attachments = new List { - new UserMessageDataAttachmentsItemFile + new AttachmentFile { Path = "/path/to/image.jpg", DisplayName = "image.jpg", @@ -310,9 +310,9 @@ await session.SendAsync(new MessageOptions await session.SendAsync(new MessageOptions { Prompt = "What's in this image?", - Attachments = new List + Attachments = new List { - new UserMessageDataAttachmentsItemBlob + new AttachmentBlob { Data = base64ImageData, MimeType = "image/png", @@ -721,13 +721,12 @@ await session2.SendAsync(new MessageOptions { Prompt = "Hello from session 2" }) await session.SendAsync(new MessageOptions { Prompt = "Analyze this file", - Attachments = new List + Attachments = new List { - new UserMessageDataAttachmentsItem + new AttachmentFile { - Type = UserMessageDataAttachmentsItemType.File, Path = "/path/to/file.cs", - DisplayName = "My File" + DisplayName = "My File", } } }); diff --git a/dotnet/src/Session.cs b/dotnet/src/Session.cs index d2f6cedbfb..1105d45346 100644 --- a/dotnet/src/Session.cs +++ b/dotnet/src/Session.cs @@ -1,4 +1,4 @@ -/*--------------------------------------------------------------------------------------------- +/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ @@ -263,7 +263,7 @@ public Task SendAsync(string prompt, CancellationToken cancellationToken /// Prompt = "Explain this code", /// Attachments = new List<Attachment> /// { - /// new() { Type = "file", Path = "./Program.cs" } + /// new AttachmentFile { Path = "./Program.cs", DisplayName = "Program.cs" } /// } /// }); ///