© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
7 replies
pedrpedrpedr

❔ What is not { } means?

async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
{
    // Only process Message updates: https://core.telegram.org/bots/api#message
    if (update.Message is not { } message)
        return;
    // Only process text messages
    if (message.Text is not { } messageText)
        return;
async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken)
{
    // Only process Message updates: https://core.telegram.org/bots/api#message
    if (update.Message is not { } message)
        return;
    // Only process text messages
    if (message.Text is not { } messageText)
        return;

So I'm looking into building a bot for telegram with C# but I don't fully understand what is going on here. What this
update.Message is not { } message
update.Message is not { } message
does? Can I add "rules" inside the curly braces to make it so it has a early return?

Where I found the code:
https://telegrambots.github.io/book/1/example-bot.html
Example - First Chat Bot - A guide to Telegram.Bot library
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Unsure what this error means
C#CC# / help
2y ago
What does code "new" means.
C#CC# / help
3y ago
❔ Do someone know what this means?
C#CC# / help
3y ago
✅ What does square bracket means in C#?
C#CC# / help
8mo ago