is that possible to add two condition on system.ling like code below :
int index = Playerx.items.FindIndex (j => j.itemID == IdItem.itemID && j.itemStock < 20);
the code i have add two condition in FindIndex function.
That is to check to find itemID at Playerx.items and Playerx.items itemStock is < 20.
Is That possible ?
Yes, you can add as many conditions as you want.
In this line:
(j => j.itemID == IdItem.itemID && j.itemStock < 20)
j.itemID == IdItem.itemID && j.itemStock < 20
- it is delegate and previous line can be replaced:
(j => {return j.itemID == IdItem.itemID && j.itemStock < 20;})
so, it is body of delegate (method). In method you can use any number of conditions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.