Arun D Arun D -4 years ago 85
ASP.NET (C#) Question

Cannot implicitly convert type 'System.Collections.Generic.List<>' to ''

I have written code as below for return list using class as below

public class UsersModel
public List<CaseValues> CaseDetails { get; set; }
public CaseValues GetCasedetails(string userName)
using (var cases = new RassiEntities())
CaseDetails = (from list in cases.Accidents
join users in cases.aspnet_Users on list.LockedBy equals users.UserId
select new CaseValues
CaseId = list.caseid
return CaseDetails ;

public class CaseValues
public int CaseId { get; set; }

Please share your suggestion.

Answer Source

Your method returns List<CaseValues>, so the signature should be,

 public List<CaseValues>  GetCasedetails(string userName)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download