Example #1
0
 public static Func <Package, bool> ToFilter(this PackageVersionRange versionInfo)
 {
     if (versionInfo == null)
     {
         throw new ArgumentNullException("versionInfo");
     }
     return(versionInfo.ToFilter <Package>(p => p.Meta.Version));
 }
Example #2
0
        /// <summary>
        /// Finds a package with the specified name and <see cref="PackageVersionRange"/>.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="versionRange">The version range.</param>
        /// <returns>Package.</returns>
        public Package Find(string name, PackageVersionRange versionRange)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (versionRange == null)
            {
                throw new ArgumentNullException("versionRange");
            }
            var filter = versionRange.ToFilter();

            return(packages.FirstOrDefault(package => package.Meta.Name == name && filter(package)));
        }