I want to get an array of characters as string values in from strings in listOfStrings that have a sum smaller than 50, but I don't know how to do that with LINQ.
I have written the code below as an illustration of what I'm rying to do:
IEnumerable<String[]> = from s in listOfStrings
where () => {
int sum = 0;
for (int i=0; i<s.Length(); i++)
{
sum += s[i];
}
return sum < 50;
}
select () =>
{
String[] t = new String[s.Length()];
for (int i=0; i<s.Length(); i++)
{
t[i] = s[i].toString();
}
return t;
}
Here listOfStrings is of type List<string[]>.
It would be hard to think of a more useless function; I'm just trying to find out how to execute stuff in lambda functions within LINQ, without making a new function to do it.
s[i]or do you want the character value?