Skip to content

Instantly share code, notes, and snippets.

@controlflow
Created October 26, 2016 00:04
Show Gist options
  • Save controlflow/40c0be27538be0083b3b63c1dd48170e to your computer and use it in GitHub Desktop.
Save controlflow/40c0be27538be0083b3b63c1dd48170e to your computer and use it in GitHub Desktop.
using System;
interface ITreeNode { }
interface IScope { }
class C
{
public bool InteriorShouldBeProcessed(ITreeNode element)
{
return !(element is IScope) || ScopeShouldBeVisited((IScope) element);
}
public bool InteriorShouldBeProcessed2(ITreeNode element)
{
return !(element is IScope s) || ScopeShouldBeVisited(s);
}
public bool InteriorShouldBeProcessed3(ITreeNode element)
{
return !(element is IScope s && !ScopeShouldBeVisited(s));
}
public bool ScopeShouldBeVisited(IScope s) => true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment