如何确定数组中是否存在特定的短整数变量值?

时间:2019-03-28 08:26:04

标签: c#

我有一个整数数组和一个短整数变量,我想知道这个短整数的值是否存在于数组中。

我尝试使用Contains,但是我不支持短整数变量,所以我无能为力。

 public List<Client> GetLogList(string userId,
                                string flagId,
                                string itemId,
                                int[] labIds,
                                string deviceId,
                                int[] actionType,
                                int? signStatus,
                                DateTime? startDate,
                                DateTime? endDate,
                                int pageIndex,
                                int pageSize)
 {
    DB.Queryable<Client, User, Item, Flag, ClientDevice, LogItem>
    ((clientOp, labUser, labItem, rfidFlag, clientDev, labUseLog) =>
      clientOp.DeviceId == clientDev.DeviceId 
       && clientOp.Operator == labUser.UserId 
       && clientOp.FlagId == rfidFlag.FlagId 
       && rfidFlag.ItemId == labItem.ItemId 
       && clientOp.Id == labUseLog.Id)
                .WhereIF(!string.IsNullOrEmpty(userId), clientOp => 
                 clientOp.Operator == userId)
                .WhereIF(!string.IsNullOrEmpty(flagId), clientOp => 
                 clientOp.FlagId == flagId)
                .WhereIF(!string.IsNullOrEmpty(itemId), rfidFlag => 
                 rfidFlag.ItemId == Convert.ToInt32(itemId))
                .WhereIF(!string.IsNullOrEmpty(deviceId), clientOp => 
                 clientOp.DeviceId == deviceId)
                .WhereIF(actionType != null && actionType.Count() > 0, 
                 clientOp => clientOp.ActionType.Contains(actionType)))
 }

0 个答案:

没有答案