Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Cannot Convert from Tasks.Task to Generic.List
Gnanavel Sekar
Jul 31 2017 9:39 AM
233
Reply
Hi Friends,
Am getting the error as below"
Error CS1503 Argument 1: cannot convert from 'System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<Model.Patient>>' to 'System.Collections.Generic.List<Model.Patient>'
this.ViewLogs = new ObservableCollection<LogInfo>(Task.Run(async () => await this.GetLogDetails()));
private async Task<IEnumerable<LogInfo>> GetLogDetails()
{
this.ViewLogs = new ObservableCollection<LogInfo>();
var listofLogs = await this.dataManager.LoggerRepository.GetAllLogsAsync();
if (listofLogs != null && listofLogs.Count() > 0)
{
foreach (var logs in listofLogs)
{
this.ViewLogs.Add(new LogInfo
{
CreationDate = logs.CreationDate,
Id = logs.id,
Levels = logs.Levels,
Logger = logs.Logger,
Message = logs.Message,
ImageLevel = this.SelectImageLevels(logs.Levels),
});
}
}
return this.ViewLogs;
}
How to resolve this error?
Thanks in advance
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Can't store big amount in Decimal(18,2) in DB.
Error: The "GenerateResource" task failed unexpectedly win7