❔ Refactor help`
Can this be written as a Linq expression?
I've been trying but I keep failing at it. I'm not as great with Linq...
3 Replies
Hi. Sure, you can SelectMany on _assignments, select on item.AssigneeId, make a where there, that's it
Read up on SelectMany a bit
Here you go:
Where clause on assignments, gets every assignment where the
any
clause equals true.
Any returns true for each AssignedUser that matches user.UserId != _user.MicrosoftId
.
I finish with a ToList() because I stored them in a list in my test. This might not be needed in your case.Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.