Not able to use linq expression

Hi Everyone,

I don’t know what happened to this Forum. No one is answering :frowning:
Can anyone please help me that why I am not able to use LinQ expressions ?

Example , ```
List keys = inner.Properties().Select(p => p.Name).ToList();

that's what I am using in my assign activity. Help me please.

Regards,
Hemal

@hemal
You are using the C# Syntax but in UiPath WE are using the VB.net Syntax

In your Case IT would Look Like this
Inner.Properties.select(function (x) x.Name).ToList

1 Like

Hi @ppr,

Still I am getting error as I am not getting Name. Please help

Regards,
Hemal

@hemal Can you post the Error that you get and also post the Screenshot of how you have used that expression ?

@supermanPunch

Where error is like, Lambda expression cannot be ‘Integer’ because ‘Integer’ is not a delegate type.

Regards,
Hemal

@hemal You don’t need to assign the type to x again, you can just keep it as x.

@supermanPunch,

But then I am not getting jsonobject properties → function(x).Name.
I am not getting Name then.

Regards,
Hemal

Here, JSONData.Properties(Function ( x) x.).ToList unable to get any properties then

@hemal What’s the Type of JSONData ?

@supermanPunch,

Newtonsoft.Json.Linq.JObject

@hemal I think the Linq Expression Should be modified a bit to this :
JSONData.Properties.Select(Function(x)x.Name).ToList

2 Likes

@supermanPunch,

I think there was the space issue right ? Thank you so much :slight_smile:

Regards,
Hemal

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.