The problem is that topAgents is dynamic – so your ToList() call is dynamic, and so is Select. That has issues that:
- you can’t use lambda expressions for dynamic calls like this;
- dynamic calls don’t find extension methods anyway.
Fortunately, the operations don’t need to be dynamic just because the element type is dynamic. You could use:
IEnumerable<dynamic> topAgents = ...;
… or just use var. Both of those should be fine.