CheckedListBoxItemのプロパティ"Value"内にある特定のIDをクエリするCheckedListBoxItemCollectionを持つwinformsコントロール(CheckedListBoxControl)をクエリする必要があります。
CheckedListBoxItemCollection items = myCheckedListBoxControl.Items;
foreach(Department dep in departmentList)
{
bool isDepExisting = items.AsQueryable().Where( the .Where clause does not exist );
// How can I query for the current dep.Id in the departmentList and compare this dep.Id with every Item.Value in the CheckedListBoxControl and return a bool from the result ???
if(!isDepExisting)
myCheckedListBoxControl.Items.Add( new CheckedListBoxItem(dep.id);
}
アップデート:
IEnumberable<CheckedListBoxItem> checks = items.Cast<CheckedListBoxItem>().Where(item => item.Value.Equals(dep.InternalId));
Visual Studioで、IEnumerableまたはIEnumberable名前空間が見つからないと言うのはなぜですか?代わりに「var」を使用すると、コードをコンパイルできます。しかし、私の会社の上司は私が変数を使用することを禁じています...