views:

157

answers:

1

Hey guys,

I want to display items in a dropdownlist like 5%, 10%, 15%, 20% until 100. Is there a way to bind an intelligent LINQ query to the datasource that will do this for me?

+18  A: 

You can use Enumerable.Range:

Enumerable.Range(1, 20).Select(x => 5 * x);

Or, in a more LINQ-like syntax:

from x in Enumerable.Range(1, 20)
select (x * 5);
Dean Harding
Great, worked like a charm!
Johan Leino