0

How get string value from while loop

private async Task getTelegramMessage() { var bot = new Telegram.Bot.TelegramBotClient("xxxxxx:XXXXXXXXXXXXXXXXXX"); string msg = string.Empty; while (true) { var updates = await bot.GetUpdatesAsync(up++); up = updates[updates.Count() - 1].Id; msg = updates[updates.Count() - 1].Message.Text; } Console.WriteLine(msg); } // I can't get msg value outside loop

8th Oct 2017, 7:11 PM
El missouri
El missouri - avatar
2 Answers
0
Declare a private string above "private async task". Assign it in the while loop and use it in your code.
8th Oct 2017, 7:18 PM
sneeze
sneeze - avatar
0
didn't work
8th Oct 2017, 7:25 PM
El missouri
El missouri - avatar