您是否发现以下C#代码清晰可辨?
private bool CanExecuteAdd(string parameter) {
return
this.Script == null ? false
: parameter == "Step" ? true
: parameter == "Element" ? this.ElementSelectedInLibrary != null && this.SelectedStep != null
: parameter == "Choice" ? this.SelectedElement != null
: parameter == "Jump" ? this.SelectedStep != null
: parameter == "Conditional jump" ? false
: false.Throw("Unknown Add parameter {0} in XAML.".F(parameter));
}
Run Code Online (Sandbox Code Playgroud)
其中Throw定义为:
public static T Throw<T>(this T ignored, string message) {
throw new Exception(message);
}
Run Code Online (Sandbox Code Playgroud)
我知道这不是惯用的C#.但是,你能在第一眼还是第二眼看到它?还是我偏离了太远?