0
foreach (SchemaInfo db in SourceSchemaInfos)
{
foreach (SchemaInfo table in db.SchemaInfos)
{
foreach (SchemaInfo tablelist in table.SchemaInfos)
{
for (int i = 0; i < SelectedTables.Count; i++)
{
if (tablelist.Key == SelectedTables[i].Key)
{
foreach (SchemaInfo _tableschema in tablelist.SchemaInfos)
{
_tableschema.IsSelected = true;
}
}
}
}
}
}
我試圖上述foreach循環轉換成LINQ查詢,如下..轉換的foreach,如果到LINQ查詢
SourceSchemaInfos.ForEach(Database =>Database.SchemaInfos.ForEach(items => items.SchemaInfos.ForEach(tables => tables.SchemaInfos.Where(tables.Key == SelectedTables.ForEach(l => l.Key)).ForEach(m => m.IsSelected = true))));
但thorws我下面的錯誤@l.Key
CS0201 Only assignment, call, increment, decrement, and new object expressions can be used as a statement
`