Zia*_*hoy 2 c# asp.net-mvc yield-return nerddinner
从我读过的,
yield return <value>
Run Code Online (Sandbox Code Playgroud)
在执行该行的那一刻跳出函数.然而,Scott Guthrie的文字表明了这一点
var errors = dinner.GetRuleViolations();
Run Code Online (Sandbox Code Playgroud)
成功提取所有规则违规的列表,即使GetRuleViolations是一个很长的列表
if(String.someFunction(text))
yield return new RuleViolation("Scary message");
if(String.anotherFunction(text))
yield return new RuleViolation("Another scary message");
Run Code Online (Sandbox Code Playgroud)
这是如何运作的?
| 归档时间: |
|
| 查看次数: |
975 次 |
| 最近记录: |