In this post, we will see how to resolve C# Linq return list of records with different flags value
Question:
I have set of targetEngagementIds in engDetails object, and want to retrive targetEngagementId from object with two different filter,- First, to get all the TargetEngagementId without any where clause.
- Second, to get only Ready Status TargetEngagementIds.
How can I club these two duplicate logic as per isActiveFlag?
Best Answer:
You can useIsActiveOnly
flag in where statement:IsActiveOnly
is false above query will return all ids. When IsActiveOnly
is true it will return those where status is Ready.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review