Do lamba expressions work in UIPath?


#1

Hello,

I’ve noticed that when using an expression with a lambda expression, UIPath always prompts an error with the following message “Expression expected”.


Remove Duplicates with LinQ
#2

UiPath uses VB.Net, not C#, so you need to use different syntax:
C#: .Where(x => x < 5) VB.Net: .Where(Function(x) x < 5)

More info:
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/lambda-expressions

Also note that the = sign is interpreted differently depending on context (so it might mean an assignment or comparison, instead of = and == like in C# and some other languages).


#3

Are you getting how to use lambda expressions in UIpath ?? If u are getting please help me how to use. Because i am also facing same issue what you were facing.


#4

hey @MahalingPatil

It is already mentioned by @andrzej.kniola

if still you are still not able to make it… then share where you are getting problem.

Regards…!!
Aksh


#5

Okay…Tq


#6

@MahalingPatil
Hi, as also noted here, Telerik’s code converter comes in handy for converting from C# to VB.Net. However, it doesn’t like the dot notation, so for the lambda shown by Andrzej it will throw an error. Just remove the “.Where” and it correctly converts (x => x < 5) to (Function(x) x < 5).

You probably know about that already, but just in case :slight_smile:

Regards,
burque505


#7

Tq…Its working for me


#8

Glad to hear it!