Impact of Gen-AI on IT Jobs - Growth Mindset Show
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
1
Reply
How to merge two IQueryable lists in LINQ?
Tamal Marick
8y
394
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
By using Concat() Or Union()var filter1 = from p in db.table1 var filter2 = from p in db.table2var filter3 = filter1.Concat(filter2); var filter4 = filter1.Union(filter2);Now, what is the difference b/w Concat() & Union() or when we use it?Union removes duplicates. Concat does not.So, they produce different results if the sources either contain any items in common, or have any internal duplicates.If you can guarantee there are no duplicates, or if there are few and you don't care about having them in your output, Concat will be faster since there's no need to test each value against what has already been yielded.However, if there are many duplicates and you don't need them, the extra processing in Union to remove the dupes may be offset by the savings in your code that consumes the results.
Tamal Marick
8y
0
Message