コード例 #1
0
 /// <summary>
 /// Tests whether a feature appears in these features.
 /// This never throws.
 /// </summary>
 /// <param name="this">This enumerable of features.</param>
 /// <param name="f">The expected feature.</param>
 /// <returns>True if the feature exists in these features.</returns>
 public static bool Has(this IEnumerable <VFeature> @this, VFeature f) => @this.Contains(f);
コード例 #2
0
 /// <summary>
 /// Tests whether a feature appears with a maximal version in these features.
 /// This never throws.
 /// </summary>
 /// <param name="this">This enumerable of features.</param>
 /// <param name="f">The expected feature.</param>
 /// <returns>True if the feature exists in these features with the expected version or a lower one.</returns>
 public static bool HasAtMost(this IEnumerable <VFeature> @this, VFeature f)
 {
     return(@this.Any(x => x.Name == f.Name && x.Version <= f.Version));
 }
コード例 #3
0
        /// <summary>
        /// Tests whether a feature name (or a versioned "Name/SVersion") appears in these features.
        /// This never throws.
        /// </summary>
        /// <param name="this">This enumerable of features.</param>
        /// <param name="featureName">The name or the "Name/SVersion".</param>
        /// <returns>True if the feature name or versioned name exists in these features.</returns>
        public static bool Has(this IEnumerable <VFeature> @this, string featureName)
        {
            var f = VFeature.TryParse(featureName);

            return(f.IsValid ? @this.Contains(f) : @this.Any(x => x.Name == featureName));
        }