score:11

Accepted answer

how about:

return _tabs.oftype<editortabviewmodel>().any(t => t.cansave);

here:

  • oftype<> is a non-buffering filter that restricts us to editortabviewmodel
  • any is short-circuiting, so returns true as soon as a match is found

score:1

using the linq extensions you could write something like

_tabs.any( p => p is editortabviewmodel && ((editortabviewmodel)t).cansave)

score:1

try something like:

return _tabs.firstordefault(y => y is editortabviewmodel && ((editorviewmodel)t).cansave) != null;

score:2

yes, you can improve. something like this would probably work:

return _tabs.any(x => x is editortabviewmodel && ((editortabviewmodel)x).cansave);

Related Query

More Query from same tag