Short version : do I need to fiddle with the Type of the ‘item’ var in a ForEach ?
In a var “mijnProcessen” I collect all running processes in my session using a GetProcesses activity.
So I ctrl-K into its var field and invent a varname, and I automatically get a Type ‘List of Processes’ back. Looking good !
But then I want to iterate over that var, so I pick a ForEach activity: the easy part is retyping the List variable. But then trouble begins : the item var that came with the ForEach does not infer that it should be of type Process. In the body of the loop I can not intellisense this : item.processname.tostring
Then I start fiddling with the ‘item’ var, replace it with a var of type “Process” and scope “body”. The compiler stops complaining at that point, but @runtime it throws “object reference not set to an instance of object”
I worked around it by using while loops with an index, but I need to get past this problem once and for all. What did I skip when reading about uipath’s foreach ?