Monday, May 20, 2013

How to select items from a list lower bound to upper bound c#?

How to select items from a list lower bound to upper bound c#?

 lowerbound = (CurrentPage - 1) * 10;
 upperbound = (CurrentPage * 10) -1;
I have an upper bound and lower bound two integers that specify what is the lowest and highest element between which elements from the List have to be accessed
        **List<string> take = list.Take(upperbound).ToList();**
How to select items from a list lower bound to upper bound c#?
        foreach (string elemt in take)
        {
            HtmlGenericControl div = new HtmlGenericControl("div");
            div.ID = "div" + elemt;


            Label text = new Label();
            text.Text = elemt;
            div.Controls.Add(text);

            divtest.Controls.Add(div);
        }