Added an extension method to make it easy for to restrict an IQueryable<IPackage> to the latest version. Handy when consuming NuGet from an application that can't use Linq directly.

This commit is contained in:
Garrett Serack 2014-03-17 10:33:02 -07:00 коммит произвёл feiling
Родитель 317ffd2829
Коммит b2e60f75b2
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -259,6 +259,14 @@ namespace NuGet
return packages.Where(BuildSearchExpression<T>(propertiesToSearch, nonNullTerms));
}
/// <summary>
/// Returns a find query that is further restricted to just the latest package version.
/// </summary>
public static IQueryable<T> FindLatestVersion<T>(this IQueryable<T> packages) where T : IPackage
{
return from p in packages where p.IsLatestVersion select p;
}
/// <summary>
/// Constructs an expression to search for individual tokens in a search term in the Id and Description of packages
/// </summary>