Skip to content

Instantly share code, notes, and snippets.

@controlflow
Created January 16, 2020 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save controlflow/618ed2d5d4e53f675cfc7dc52a22a051 to your computer and use it in GitHub Desktop.
Save controlflow/618ed2d5d4e53f675cfc7dc52a22a051 to your computer and use it in GitHub Desktop.
var operand = dagOwnerElement.SourceElement is IIsExpression sourceIsExpression ? sourceIsExpression.Operand
: dagOwnerElement.SourceElement is ISwitchStatement sourceSwitchStatement ? sourceSwitchStatement.GoverningExpression
: dagOwnerElement.SourceElement is ISwitchExpression sourceSwitchExpression ? sourceSwitchExpression.GoverningExpression
: null;
var operand = dagOwnerElement.SourceElement switch {
IIsExpression sourceIsExpression => sourceIsExpression.Operand,
ISwitchStatement sourceSwitchStatement => sourceSwitchStatement.GoverningExpression,
ISwitchExpression sourceSwitchExpression => sourceSwitchExpression.GoverningExpression,
_ => null
};
var operand = dagOwnerElement.SourceElement switch {
IIsExpression x => x.Operand,
ISwitchStatement x => x.GoverningExpression,
ISwitchExpression x => x.GoverningExpression,
_ => null
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment