I have two lists that are of the same length, is it possible to loop through these two lists at once?
I am looking for the correct syntax to do the below
I have this small function which helps me to iterate through this two list objects. schema is of type SqlData, which is a class that hold three properties. And data is a list that holds values of dynamic type. First I'm iterating through the schema collection and than using the index of item to iterate through the data object.
public List<SqlData> SqlDataBinding(List<SqlData> schema, List<dynamic> data)
{
foreach (SqlData item in schema)
{
item.Values = data[schema.IndexOf(item)];
}
return schema
}