.NET C# Adaptive Card Example | Simple Text and Image Block

This example contains the .NET C# code to create an Adaptive card with simple text and image blocks. Start by adding the AdaptiveCards NuGet package to the dependencies of your project.

For other examples visit our bot series here.

Remember to change the inputs and version in the below card. I have mentioned both C# code and JSON for your understanding.

.NET C# Adaptive Card Example

using AdaptiveCards;
// ...

AdaptiveCard card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 3));

card.Body.Add(new AdaptiveTextBlock() 
    Text = "Hello World",
    Size = AdaptiveTextSize.ExtraLarge

card.Body.Add(new AdaptiveImage() 
    Url = new Uri("http://adaptivecards.io/content/cats/1.png")

// serialize the card to JSON
string json = card.ToJson();

JSON Adaptive Card Example

    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3",
    "body": [
            "type": "TextBlock",
            "text": "Hello World",
            "wrap": true,
            "size": "ExtraLarge"
            "type": "Image",
            "url": "http://adaptivecards.io/content/cats/1.png"

Thank you All!!! Hope you find this useful.

Leave a Reply

Up ↑