Although with just plane "as", you still have to check for null. I'd like so see something like
with (CheckBox chk = o as CheckBox)
{
// body
}
where body is only executed if o is a CheckBox. This could be expanded out to...
with (CheckBox chk = o as CheckBox)
{
// body
}
else with (ToolBarButton tbb = o as ToolBarButton)
{
// other body
}
else
{
// another body
}
That would be useful to me, and quite compact. But I think "with" is a VB keyword, isn't it?