зеркало из https://github.com/mono/nuget.git
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:
Родитель
317ffd2829
Коммит
b2e60f75b2
|
@ -259,6 +259,14 @@ namespace NuGet
|
||||||
return packages.Where(BuildSearchExpression<T>(propertiesToSearch, nonNullTerms));
|
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>
|
/// <summary>
|
||||||
/// Constructs an expression to search for individual tokens in a search term in the Id and Description of packages
|
/// Constructs an expression to search for individual tokens in a search term in the Id and Description of packages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче