0
Personal talk. to starting in C# (as you will notice in the question haha) and to with a doubt
I have a list of values list a = [1,2,4,5,9,8,1,4,5,2,10,18]
would like to know if there is any way to count these values based on a rule for example: double group1 = Count. a Where a < 2; double group2 = Count. a Where a> 4 and < 8;
(I know it’s not these commands, it’s just to illustrate the doubt)
I thought of something like
countElements element = new countElements();
list a = [1,2,4,5,9,8,1,4,5,2,10,18]
foreach (var item in a)
{
if (item < 2)
{
element.group1 = +1;
}
else (item > 4 and item< 8)
{
element.group2 = +1;
}
}
double group1 = element.group1;
double group2 = element.group2;
thank you since
What is and how is this class
countElements()
?– Leandro Angelo