Hi,

Is it possbile to join only specific items in a list using indexes.
Lets say I have 100 items,i would only like to join items[1-30].

Please advise.

Recommended Answers

All 2 Replies

Something like this should work:

List<int> testlist = new List<int>();
//fill list here
int startindex = 1;
int endindex = 30;
string joinedindexes = string.Join(" ", testlist.GetRange(startindex, endindex - startindex).ToArray());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.