示例#1
0
 public async IAsyncEnumerable <TelegramContact> GetContacts()
 {
     await foreach (var contact in _telegramSession.GetContacts())
     {
         yield return(contact);
     }
 }
示例#2
0
        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);
        }