Reporter | Drew Noakes (drewnoakes) |
---|---|
Created | Feb 16, 2012 12:26:07 AM |
Updated | Feb 16, 2012 12:26:07 AM |
Priority | Normal |
Type | Feature |
Fix versions | No Fix versions |
State | Submitted |
Assignee | Unassigned |
Subsystem | No subsystem |
Affected versions | 6.1 |
Fixed in build | No Fixed in build |
foreach (MainMenuItem item in Items) { if (item.Content is Menu) { ((Menu)item.Content).Hide(); } }
R# turns out:
foreach (MainMenuItem item in Items.Where(item => item.Content is Menu)) { ((Menu)item.Content).Hide(); }
But in fact a simpler result would be:
foreach (Menu item in Items.Select(item => item.Content).OfType<Menu>()) { item.Hide(); }