Skip to content

Proposal: Queryable.Append, Queryable.Prepend #19563

@jamesqo

Description

@jamesqo

Important note: There is a chance this API could be breaking. People who are already calling Append on some Queryable will be calling into the Enumerable version, which returns an IEnumerable<T>. Meanwhile, the proposed overloads return an IQueryable<T>. However, these APIs have been out for less than a year and people seem to agree that keeping symmetry with Enumerable is more valuable.


Per discussion at dotnet/corefx#14186 (comment) We should add Queryable.Append and Prepend extension methods since they already exist on Enumerable.

Proposal

namespace System.Linq
{
  public static class Queryable
  {
    public static IQueryable<TSource> Append<TSource>(this IQueryable<TSource> source, TSource element);
    public static IQueryable<TSource> Prepend<TSource>(this IQueryable<TSource> source, TSource element);
  }
}

cc @JonHanna @bartdesmet

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implementedarea-System.Linqhelp wanted[up-for-grabs] Good issue for external contributors

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions