How to use not equal in linq

Hi Team,

I want to get the salary having value greater than 50000 and name is not equal to ganesh but the below query does not work out. How to use not equal to in linq and <> does not work.

(from a in dtsource.AsEnumerable where convert.ToInt32(a(“Salary”))>50000 AND a(“Name”) isnot “Ganesh” select a).CopyToDataTable


check this :slight_smile:

You can just use != operator as well.

1 Like

Hi @Divyashreem

Thank you but when i use != an alert comes as identify expected. Do i need to include anything?


@Boopathi I guess you can try this expression after and operator :
Not (a(“Name”).toString.Equals(“Ganesh”))

1 Like

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