I have seen a number of answers for this problem but can't find that how can i resolve the issue I'm facing.
I had the following code vb
Public Shared Function GetOtherDomains() As List(Of DomainModel)
Dim list As New List(Of DomainModel)
Dim items As List(Of Object) = BusinessFactory.tblDomain.GetOtherDomains(Sessions.LoginID)
For Each item As Object In items
Dim model As New DomainModel()
With model
.LoginID = item.LoginID
.DomainID = item.CompanyID
.CompanyName = item.CompanyName
.RoleName = item.RoleName
End With
list.Add(model)
Next
Return list
End Function
I converted the code in c# as below and now getting the error('object' does not contain a definition for 'LoginID')
public static List<DomainModel> GetOtherDomains()
{
List<DomainModel> list = new List<DomainModel>();
List<dynamic> items = BusinessFactory.tblDomain.GetOtherDomains(Sessions.LoginID);
foreach (dynamic item in items)
{
DomainModel model = new DomainModel();
model.LoginID = item.LoginID;
model.DomainID = item.CompanyID;
model.CompanyName = item.CompanyName;
model.RoleName = item.RoleName;
list.Add(model);
}
return list;
}
Please let me know that how it can be resolved?
