Hi Guys
I am trying to upskill of my linq query but I am not understand of tolookup concept how to use it and what is situation to use tolookup in linq query I found this vb code for learning website but its seem to be not understandable for me .
Private Shared Sub Sample_ToLookup_Lambda()
Dim words As String() = {“one”, “two”, “three”, “four”, “five”, “six”, _
“seven”}
Dim result = words.ToLookup(Function(w) w.Length)
For i As Integer = 1 To 5
Debug.WriteLine([String].Format("Elements with a length of {0}:", i))
For Each word As String In result(i)
Debug.WriteLine(word)
Next
Next
hi peter thank you so much for replay can you please share syntax of grouping in uipath I am quite confuse of tutorial teacher but I need full understanding of Group by and lookup I am using this document to understand but its not clear my doubt
how could I use group in array like i have {10,20,50,35,40} and I need number which is divided
by 10
what is meaning of here k and grp etc.
what is here lets etc
about the let keyword you got answered some days back: LINK
k is representing the key which is used for grouping and acts similar a local variable within the LINQ statement. Same is for cd, cn ,ra, grp and let it use within the statement.
grp is representing the current group within the LINQ statement
A more info to the LINQ Query syntax find here:
how could I use group in array like i have {10,20,50,35,40} and I need number which is divided
by 10
Maybe it looks more as a filter task:
But could look like this:
same in the Query Syntax:
(From i in {10,20,50,35,40}
Group i by k=(i Mod 10) into grp=Group
Select grp.ToArray).ToList