contains in linq query

前端 未结 4 404
青春惊慌失措
青春惊慌失措 2021-01-16 01:59

Hi i am using entity framework and LinQ. I have a table objects called users . i have a list called userids. i have to find all users where ids contains in the string. I hav

4条回答
  •  广开言路
    2021-01-16 02:20

    var u = context.users,Where(o=> usersid.contains(o=> o.userid)),select(o=> o);
    

    Assuming that this is the code you are using

    var u = context.users.Where(o=> usersid.Contains(o => o.userid)).Select(o => o);
    

    make sure that you are using . instead of , and that you have the correct case on your Methods.

提交回复
热议问题