Last post Aug 14, 2014 04:41 AM by Fred Bao - MFST
Aug 12, 2014 03:32 PM|mohammed.kamran.azam|LINK
i have this below code
public async static Task<ME_PostSections> GetObjectByIDAsync(int id, MediaEntities context)
return await context.ME_PostSections.Where(x => x.PostSectionID == id).FirstOrDefaultAsync();
it throws this error
Error 3 Cannot convert method group 'FirstOrDefault' to non-delegate type 'ProjectABC.AppCode.DAL.MediaModel.ME_PostSections'. Did you intend to invoke the method? E:\My Repository\ProjectABC\Code\AppCode\BLL\MediaBLL\PostSectionsBL.cs 53 32 ProjectABC
Aug 14, 2014 04:41 AM|Fred Bao - MFST|LINK
Which line does it cause this error? With your provided code, I test it and seems to be ok.
And this error is usually caused by we are using the 'FirstOrDefault' as a property rather than a method as: .FirstOrDefault which is missing brackets “()”: .FirstOrDefault().
Please check if you are under this scenario, and if this does not work for you, please let me know.