Reputation: 111
I have a simple model like:
public class MyDataClass
{
public Guid Value1 { get; set; }
public Guid Value2 { get; set; }
}
Then I have anonymousTypeList like:
var parameterstest = assignNotificationTableType
.Select(x => new { TaskId, x.EmpGuid })
.ToList();
So I want to convert that anonymous type list to a normal list so I try:
List<MyDataClass> lista = new List<MyDataClass>();
foreach(var i in parameterstest)
{
lista.Add(i.TaskId,i.EmpGuid);
}
But I get
Error CS1501 No overload for method 'Add' takes 2 arguments
Upvotes: 0
Views: 139
Reputation: 190943
You can use it simply:
var parameterstest = assignNotificationTableType
.Select(x => new MyDataClass { Value1 = TaskId, Value2 = x.EmpGuid })
.ToList();
Upvotes: 9