本文整理汇总了C#中ReadOnlyCollection.Any方法的典型用法代码示例。如果您正苦于以下问题:C# ReadOnlyCollection.Any方法的具体用法?C# ReadOnlyCollection.Any怎么用?C# ReadOnlyCollection.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadOnlyCollection
的用法示例。
在下文中一共展示了ReadOnlyCollection.Any方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CandidateExamAdded
public bool CandidateExamAdded(ReadOnlyCollection<HtmlTableCell> candidateExamsGridFirstRowData,
CandidateExam candidateExam)
{
var isCandidateCountSame =
candidateExamsGridFirstRowData.Any(d => d.InnerText == candidateExam.CandidatesCountLimit);
var isStartDateSame = candidateExamsGridFirstRowData.Any(d => d.InnerText == candidateExam.StartTime);
var isTrainingRoomSame = candidateExamsGridFirstRowData.Any(d => d.InnerText == candidateExam.TrainingRoom);
var isCandidateExamAdded = isCandidateCountSame && isStartDateSame && isTrainingRoomSame;
return isCandidateExamAdded;
}
开发者ID:Team-Griffin-SQA-2015,项目名称:TelerikAcademyCustomTestFramework,代码行数:12,代码来源:CandidateExamsPageValidator.cs
示例2: IpV6MobilityOptionFlowSummary
/// <summary>
/// Creates an instance from a collection of flow identifiers.
/// </summary>
/// <param name="flowIdentifiers">
/// Indicating a registered FID.
/// One or more FID fields can be included in this option.
/// </param>
public IpV6MobilityOptionFlowSummary(ReadOnlyCollection<ushort> flowIdentifiers)
: base(IpV6MobilityOptionType.FlowSummary)
{
if (!flowIdentifiers.Any())
throw new ArgumentOutOfRangeException("flowIdentifiers", flowIdentifiers, "Must not be empty.");
FlowIdentifiers = flowIdentifiers;
}
示例3: AggregateDependency
///<summary>Creates a new AggregateDependency.</summary>
public AggregateDependency(IEnumerable<Dependency> dependencies)
{
if (dependencies == null) throw new ArgumentNullException("dependencies");
Dependencies = new ReadOnlyCollection<Dependency>(dependencies.ToArray());
RequiresDataContext = Dependencies.Any(d => d.RequiresDataContext);
foreach (var child in dependencies) {
child.RowInvalidated += (sender, e) => OnRowInvalidated(e);
}
}
示例4: LiteralConversion
/// <summary> Creates a new literal conversion. </summary>
/// <param name="components"> The components that can be successfully parsed. </param>
/// <param name="result"> The result domain of the conversion. </param>
public LiteralConversion(Domain result, ReadOnlyCollection<Domain> components)
{
Contract.Requires(components != null);
Contract.Requires(components.Any(domain => domain.ToKind().IsLiteral()), "At least one literal must be present");
Contract.Requires(Contract.ForAll(components, domain => Enum.IsDefined(typeof(Domain), domain)), "Undefined domain kind");
Contract.Requires(Contract.ForAll(components, domain => domain.ToKind().IsOperand() || domain.ToKind().IsLiteral()), "No operators are allowed in the literal conversion");
Contract.Requires(Enum.IsDefined(typeof(Domain), result));
this.Components = components;
this.Key = components.First(domain => domain.ToKind().IsLiteral());
this.Result = result;
}
示例5: OnInitialize
protected override bool OnInitialize(ReadOnlyCollection<string> args)
{
bool mockSoS = false;
bool showSplash = true;
_startMinimized = false;
if (args.Any(s => s == "/nosplash"))
{
showSplash = false;
}
if (args.Any(s => s == "/mocksos"))
{
mockSoS = true;
}
if (args.Any(s => s == "/min"))
{
_startMinimized = true;
}
_log.Debug(string.Format("OnInitialize() starting; mockSos = {0}; showSplash = {1}, startMinimized = {2}", mockSoS, showSplash, _startMinimized));
// todo: we shouldn't need to do this
IocContainer.Instance.Register(typeof(AudioFileService), new AudioFileService());
IocContainer.Instance.Register(typeof(LedFileService), new LedFileService());
if (mockSoS)
{
IocContainer.Instance.Register(typeof(ISirenOfShameDevice), new MockSirenOfShameDevice());
}
else
{
IocContainer.Instance.Register(typeof(ISirenOfShameDevice), new SirenOfShameDevice());
}
IocContainer.Instance.GetExport<ISirenOfShameDevice>().TryConnect();
IocContainer.Instance.TryLogAssemblyVersions();
if (showSplash)
{
SplashScreen = new SplashScreen();
}
return base.OnInitialize(args);
}
示例6: GetRecompileRequiredFunction
// <summary>
// Returns a delegate indicating (when called) whether a change has been identified
// requiring a complete recompile of the query.
// </summary>
internal Func<bool> GetRecompileRequiredFunction()
{
// assign list to local variable to avoid including the entire Funcletizer
// class in the closure environment
var recompileRequiredDelegates = new ReadOnlyCollection<Func<bool>>(_recompileRequiredDelegates);
return () => recompileRequiredDelegates.Any(d => d());
}
示例7: PickPluginFromMultipleSupportedPlugins
/// <summary>
/// The pick plugin from multiple supported plugins.
/// </summary>
/// <param name="pluginsToUse">
/// The plugins to use.
/// </param>
/// <returns>
/// The <see cref="IPlugin"/>.
/// </returns>
public IPlugin PickPluginFromMultipleSupportedPlugins(ReadOnlyCollection<IPlugin> pluginsToUse)
{
if (pluginsToUse != null && pluginsToUse.Any())
{
return pluginsToUse.First();
}
return null;
}
示例8: VisibilityOfAllElementsLocatedBy
/// <summary>
/// An expectation for checking that all elements present on the web page that
/// match the locator are visible. Visibility means that the elements are not
/// only displayed but also have a height and width that is greater than 0.
/// </summary>
/// <param name="elements">list of WebElements</param>
/// <returns>The list of <see cref="IWebElement"/> once it is located and visible.</returns>
public static Func<IWebDriver, ReadOnlyCollection<IWebElement>> VisibilityOfAllElementsLocatedBy(ReadOnlyCollection<IWebElement> elements)
{
return (driver) =>
{
try
{
if (elements.Any(element => !element.Displayed))
{
return null;
}
return elements.Any() ? elements : null;
}
catch (StaleElementReferenceException)
{
return null;
}
};
}
示例9: RegisterModules
public static void RegisterModules(List<IModule> modules)
{
Modules = new ReadOnlyCollection<IModule>(modules);
IsReportEnabled = Modules.Any(item => item.Name == "Отчёты");
}
示例10: EpmPropertyExistsInDeclaredProperties
private static bool EpmPropertyExistsInDeclaredProperties(EntityPropertyMappingAttribute epmAttr, ReadOnlyCollection<ResourceProperty> declaredProperties)
{
int index = epmAttr.SourcePath.IndexOf('/');
string propertyToLookFor = (index == -1) ? epmAttr.SourcePath : epmAttr.SourcePath.Substring(0, index);
return declaredProperties.Any<ResourceProperty>(p => (p.Name == propertyToLookFor));
}
示例11: CompileSingleLambda
private Expression<Action<FunctionContext>> CompileSingleLambda(ReadOnlyCollection<StatementAst> statements,
ReadOnlyCollection<TrapStatementAst> traps,
string funcName,
IScriptExtent entryExtent,
IScriptExtent exitExtent,
ScriptBlockAst rootForDefiningTypesAndUsings)
{
_currentFunctionName = funcName;
_loopTargets.Clear();
_returnTarget = Expression.Label("returnTarget");
var exprs = new List<Expression>();
var temps = new List<ParameterExpression>();
GenerateFunctionProlog(exprs, temps, entryExtent);
if (rootForDefiningTypesAndUsings != null)
{
GenerateTypesAndUsings(rootForDefiningTypesAndUsings, exprs);
}
var actualBodyExprs = new List<Expression>();
if (CompilingMemberFunction)
{
temps.Add(_returnPipe);
}
CompileStatementListWithTraps(statements, traps, actualBodyExprs, temps);
exprs.AddRange(actualBodyExprs);
// We always add the return label even if it's unused - that way it doesn't matter what the last
// expression is in the body - the full body will always have void type.
exprs.Add(Expression.Label(_returnTarget));
GenerateFunctionEpilog(exprs, exitExtent);
temps.Add(LocalVariablesParameter);
Expression body = Expression.Block(temps, exprs);
// A return from a normal block is just that - a simple return (no exception).
// A return from a trap turns into an exception because the trap is compiled into a different lambda, yet
// the return from the trap must return from the function containing the trap. So we wrap the full
// body of regular begin/process/end blocks with a try/catch so a return from the trap returns
// to the right place. We can avoid also avoid generating the catch if we know there aren't any traps.
if (!_compilingTrap &&
((traps != null && traps.Count > 0)
|| statements.Any(stmt => AstSearcher.Contains(stmt, ast => ast is TrapStatementAst, searchNestedScriptBlocks: false))))
{
body = Expression.Block(
new[] { _executionContextParameter },
Expression.TryCatchFinally(
body,
Expression.Call(
Expression.Field(_executionContextParameter, CachedReflectionInfo.ExecutionContext_Debugger),
CachedReflectionInfo.Debugger_ExitScriptFunction),
Expression.Catch(typeof(ReturnException), ExpressionCache.Empty)));
}
else
{
// Either no traps, or we're compiling a trap - either way don't catch the ReturnException.
body = Expression.Block(
new[] { _executionContextParameter },
Expression.TryFinally(
body,
Expression.Call(
Expression.Field(_executionContextParameter, CachedReflectionInfo.ExecutionContext_Debugger),
CachedReflectionInfo.Debugger_ExitScriptFunction)));
}
return Expression.Lambda<Action<FunctionContext>>(body, funcName, new[] { _functionContext });
}
示例12: GetChilds
private IEnumerable<UIElement> GetChilds(ReadOnlyCollection<UIElement> elements)
{
if(elements.Any())
return new UIElement[0];
return elements.Select(GetChilds).Aggregate((all, next) => all.Concat(next)).ToArray();
}
示例13: CompileSingleLambda
private Expression<Action<FunctionContext>> CompileSingleLambda(ReadOnlyCollection<StatementAst> statements, ReadOnlyCollection<TrapStatementAst> traps, string funcName, IScriptExtent entryExtent, IScriptExtent exitExtent)
{
this._currentFunctionName = funcName;
this._loopTargets.Clear();
this._returnTarget = Expression.Label("returnTarget");
List<Expression> exprs = new List<Expression>();
this.GenerateFunctionProlog(exprs, entryExtent);
List<Expression> list2 = new List<Expression>();
List<ParameterExpression> temps = new List<ParameterExpression>();
this.CompileStatementListWithTraps(statements, traps, list2, temps);
exprs.AddRange(list2);
exprs.Add(Expression.Label(this._returnTarget));
Version version = Environment.Version;
if (((version.Major == 4) && (version.Minor == 0)) && ((version.Build == 0x766f) && (version.Revision < 0x40d6)))
{
exprs.Add(Expression.Call(CachedReflectionInfo.PipelineOps_Nop, new Expression[0]));
}
this.GenerateFunctionEpilog(exprs, exitExtent);
temps.Add(_outputPipeParameter);
temps.Add(this.LocalVariablesParameter);
Expression body = Expression.Block((IEnumerable<ParameterExpression>) temps, (IEnumerable<Expression>) exprs);
if (!this._compilingTrap && (((traps != null) && traps.Any<TrapStatementAst>()) || (from stmt in statements
where AstSearcher.Contains(stmt, ast => ast is TrapStatementAst, false)
select stmt).Any<StatementAst>()))
{
body = Expression.Block(new ParameterExpression[] { _executionContextParameter }, new Expression[] { Expression.TryCatchFinally(body, Expression.Call(Expression.Field(_executionContextParameter, CachedReflectionInfo.ExecutionContext_Debugger), CachedReflectionInfo.Debugger_ExitScriptFunction), new CatchBlock[] { Expression.Catch(typeof(ReturnException), ExpressionCache.Empty) }) });
}
else
{
body = Expression.Block(new ParameterExpression[] { _executionContextParameter }, new Expression[] { Expression.TryFinally(body, Expression.Call(Expression.Field(_executionContextParameter, CachedReflectionInfo.ExecutionContext_Debugger), CachedReflectionInfo.Debugger_ExitScriptFunction)) });
}
return Expression.Lambda<Action<FunctionContext>>(body, funcName, new ParameterExpression[] { _functionContext });
}
示例14: Signature
/// <summary> Allows to construct a set from a generic definition set. </summary>
private Signature(ReadOnlyCollection<ISet> genericSetArguments, string description)
: base(genericSignatureDefinition, genericSetArguments, description ?? GetDefaultSignatureDescription(genericSetArguments))
{
Contract.Requires(genericSetArguments != null);
Contract.Requires(genericSetArguments.Any(NotNull));
Contract.Assert(genericSignatureDefinition.Supersets(this));
}