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 use
IsActiveOnlyflag in where statement:
IsActiveOnlyis false above query will return all ids. When
IsActiveOnlyis true it will return those where status is Ready.
If you have better answer, please add a comment about this, thank you!