/// <summary> /// Executes of the constraint provided by the <see cref="Constraint"/> property /// against a given <see cref="ExportDefinition"/> to determine if this /// <see cref="ImportDefinition"/> can be satisfied by the given <see cref="Export"/>. /// </summary> /// <param name="exportDefinition"> /// A definition for a <see cref="Export"/> used to determine if it satisfies the /// requirements for this <see cref="ImportDefinition"/>. /// </param> /// <returns> /// <see langword="True"/> if the <see cref="Export"/> satisfies the requirements for /// this <see cref="ImportDefinition"/>, otherwise returns <see langword="False"/>. /// </returns> /// <remarks> /// <note type="inheritinfo"> /// Overrides of this method can provide a more optimized execution of the /// <see cref="Constraint"/> property but the result should remain consistent. /// </note> /// </remarks> /// <exception cref="ArgumentNullException"> /// <paramref name="exportDefinition"/> is <see langword="null"/>. /// </exception> public virtual bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition) { Requires.NotNull(exportDefinition, nameof(exportDefinition)); _compiledConstraint ??= Constraint.Compile(); return(_compiledConstraint.Invoke(exportDefinition)); }