我在C#中新有这样的变种:
如何设置初始化var c#?
var updates = await Bot.GetUpdatesAsync(offset);
但现在要更新定义其他范围,并用这种形状使用它:
updates = await Bot.GetUpdatesAsync(offset);
尝试定义此代码:
var updates =(string) null;
但在这行C#编译器收到此错误:
updates = await Bot.GetUpdatesAsync(offset);
(awaitable)Task<Update[]> TelegramBotClient.GetUpdatesAsync([int offset=0],[int limit=100],[int timeout=0],[CancellationToken cancellationToken=default(CancellationToken)
use this method recieve incoming updates using long polling.
Usage:
Update[] x=await GetUpdateAsync(...);
Can not implicitly convert type 'Telegram.Bot.Types.Update[]' to 'string'
我怎样才能解决这个代码感谢:
var updates =(string) null;
当然更换
var updates =(string) null;
如果你设置'var'为'string'它不会转换'Telegram.Bot.Types.Update [ ]'到'string'并且会抛出错误。 – Mairaj