Skip to content

Instantly share code, notes, and snippets.

@jordansjones
Created August 7, 2013 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordansjones/6170262 to your computer and use it in GitHub Desktop.
Save jordansjones/6170262 to your computer and use it in GitHub Desktop.
Linq to Rest API
// Service Client doesn't make the call until we attempt to enumerate the results (.ToList())
var serviceClient = new UsersServiceClient();
List<User> disabledUsers = serviceClient.Get().Where(user => user.IsDisabled).ToList();
// Or a more complex example
var serviceClient = new IssuesServiceClient();
var query = serviceClient.Get()
// At this point the query hasn't run
query = from issue in query
where State == "open"
&& Milestone > 1
orderby Created ASC;
// Now run the query
IEnumerable<Issue> issues = await (query.Skip(10));
@earaya
Copy link

earaya commented Aug 7, 2013

I don't get the point of this. Won't you be issuing a request for all records for this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment