如何在电报机器人中每 1 行显示 1 个按钮?

How to display 1 button per 1 line in telegram bot?

我正在使用 InlineKeyboardMarkup 向我的机器人添加键盘。在下面的代码中:所有按钮都显示在 1 行中。如何实现每 1 行显示 1 个按钮?

感谢您的宝贵时间。

var mainKeyBoard = new InlineKeyboardMarkup(new[] 
{
InlineKeyboardButton.WithCallbackData("beer"), InlineKeyboardButton.WithCallbackData("price"), 
InlineKeyboardButton.WithCallbackData("support") 
});

想通了。新行需要新数组到数组中。对于我上面的示例,它是这样工作的:

 static InlineKeyboardMarkup mainKeyBoard = new InlineKeyboardMarkup(new[] {
            new[]
            {
                InlineKeyboardButton.WithCallbackData("beer")
            },
            new[]
            {
                InlineKeyboardButton.WithCallbackData("price"),
            },
            new[]
            {
                InlineKeyboardButton.WithCallbackData("support")
            }
        });