I am selecting top 3 records from the Database. I want to display last 2 records except first record .How can we do this with C#. i am using asp.net 2.0 ,so cannot use linq .
Won't it be:
List<string> list = new List<string>();
for (int i = 1; i < 3; i++)
{
string s = list[i];
}
And if you are sure that it would always be the 2nd and 3rd items only, you can directly refer to them through the index value like: list[1]
and list[2]
Why can't you just index into the list. Assuming you have only 3 items in the list:
var item2 = list[1];
var item3 = list[2];
this will give you items 2 and 3. Unless if I misunderstood the question...
for (int i = 1; i < 3; i++)
{
DisplayData(dataStructure[i]);
}
Sorry I didnt see the "so cannot use linq " part
Add them to a List and use linq Skip
Something similar to
var allButFirst1 = waOrders.Skip(1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.