Reputation: 69
How to do that from List ids in which 10 items in List cids, came in turn on 2 items?
internal List<items> test(List<long> ids)
{
//ids = 10 items
List<long> cids = new List<long>(); // max 2 items in List<long> ids
var result= classA.GetValue(cids); //max cids items 2
return result;
}
Upvotes: 1
Views: 6451
Reputation: 460098
Is it really so simply? Use Take
:
internal List<items> test(List<long> ids)
{
return classA.GetValue(ids.Take(2).ToList()).Take(2).ToList();
}
I dont know why you need to take 2 from the ids and pass these to GetValue
as mentioned.
Upvotes: 5
Reputation: 5549
Using Linq,
var cids = ids.Take(2).ToList();
That's probably the simplest. Not much more to add... unless I gravely misunderstood the question.
Upvotes: 2