This question is locked. New answers and comments are not allowed.
I am using Linq Query and want to return the collection and iterate all database fields but on the bold line below I got the following error.
Dim IGroups = From Groups In dbContext.FF_Groups
Where Groups.TariffID = nTariffID
Select Groups.ID, Groups.GroupName, Groups.GroupOrder, Groups.IsDeleted, Groups.TariffID, Groups.CreatedOn, Groups.CreatedBy
Error Occurs in that line :
Dim IGroupList As IList(Of FFDataLayer.FFDataLayer.FF_Group) = IGroups.ToList
Error:
Unable to cast object of type 'System.Collections.Generic.List`1[VB$AnonymousType_1`7[System.Int64,System.String,System.Nullable`1[System.Int64],System.Boolean,System.Int64,System.DateTime,System.Int64]]' to type 'System.Collections.Generic.IList`1[FFDataLayer.FFDataLayer.FF_Group]'.
Dim IGroups = From Groups In dbContext.FF_Groups
Where Groups.TariffID = nTariffID
Select Groups.ID, Groups.GroupName, Groups.GroupOrder, Groups.IsDeleted, Groups.TariffID, Groups.CreatedOn, Groups.CreatedBy
Error Occurs in that line :
Dim IGroupList As IList(Of FFDataLayer.FFDataLayer.FF_Group) = IGroups.ToList
Error:
Unable to cast object of type 'System.Collections.Generic.List`1[VB$AnonymousType_1`7[System.Int64,System.String,System.Nullable`1[System.Int64],System.Boolean,System.Int64,System.DateTime,System.Int64]]' to type 'System.Collections.Generic.IList`1[FFDataLayer.FFDataLayer.FF_Group]'.