Answer the question
In order to leave comments, you need to log in
How to make random element in .Find/.FirstOrDefault?
He chooses the first one by condition, but how can you choose random with such conditions?
It is possible, of course, through a loop, but is it possible somehow in one line?
Brawler RandomBrawler = null;
RandomBrawler = player.PlayerBrawlers.FirstOrDefault(item => item.Level >= 7 && item.Starpowers.Any(x => x.Have == false));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question