Friday, March 14, 2008


To extract from array a sub array by a condition can be used next way:

List<int> subList = new List<int>();
for (int i = 0; i < data.Length; i++)
if (data[i] >= minValue && data[i] <= maxValue)
return subList.ToArray();

Bug csharp it is suggested to use method Array.FindAll by next way:

return Array.FindAll(data, delegate(int value)
return value >= minValue && value <= maxValue;


Array..::.FindAll<(Of <(T>)>) Generic Method

No comments: