本文整理汇总了C#中IScript.Where方法的典型用法代码示例。如果您正苦于以下问题:C# IScript.Where方法的具体用法?C# IScript.Where怎么用?C# IScript.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScript
的用法示例。
在下文中一共展示了IScript.Where方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetermineDiff
// This is kind of a SELECT N + 1 lots of times. With many scripts the performance will be pretty bad.
// Most people wont use that many scripts so it's not so bad I think.
public IEnumerable<ScriptState> DetermineDiff(IScript[] scriptLog, IScript[] sourceScripts)
{
scriptLog = scriptLog.OrderBy(s => s.Name, NaturalSortOrderComparer.Instance).ToArray();
sourceScripts = sourceScripts.OrderBy(s => s.Name, NaturalSortOrderComparer.Instance).ToArray();
foreach (var script in sourceScripts)
{
if (IsAlreadyExecuted(script, scriptLog))
yield return new ScriptState(script, ScriptState.States.AlreadyExecuted);
else if (HasContentChanged(script, scriptLog))
yield return new ScriptState(script, ScriptState.States.ContentChanged);
else if (IsNew(script, scriptLog))
yield return new ScriptState(script, ScriptState.States.New);
}
foreach (var removed in scriptLog.Where(s => IsRemoved(s, sourceScripts, scriptLog)))
yield return new ScriptState(removed, ScriptState.States.Removed);
}