public async IAsyncEnumerable <TelegramContact> GetContacts() { await foreach (var contact in _telegramSession.GetContacts()) { yield return(contact); } }
public async Task <IEnumerable <TelegramContact> > GetContacts() { _logger.LogInformation("ConnectionId = {ConnectionId}", HttpContext.Connection.Id); var contacts = new List <TelegramContact>(); await foreach (var contact in _telegramSession.GetContacts()) { contacts.Add(contact); } return(contacts); }