objTempList = objParentList;
foreach (var item in objTempList)
{
objChildList = objList.AsQueryable()
.Where(x => x._parentId == item.filedbid)
.ToList<FileObjectView>();
if (objChildList != null)
{
foreach (var child in objChildList)
{
objParentList.Add(child);
}
}
}
Above is my code, problem is the assignment of objTempList = objParentList
objParentList has 10 rows which are assigned to objTempList
now in next step when i am doing foreach and adding more rows in objParentList its automaticaly reflecting in list objTempList and my loop is giving error message.
You should separate list instances to avoid this error