How can we find sequence of items in two different array (same type) in the same order using linq query?
Answer / Pankaj Kumar Bola
{"C# LINQ example for finding a sequence of items in two arrays with the same type and in the same order:n```csharpnint[] array1 = { 1, 2, 3, 4, 5 }; // sample array 1nint[] array2 = { 1, 2, 3 }; // sample array 2nvar commonElements = array1.Intersect(array2); // using the Intersect method to find common elementsnforeach (int element in commonElements) {nConsole.WriteLine(element);n}n```}
| Is This Answer Correct ? | 0 Yes | 0 No |
How to write where condition in linq?
What is linq in dot net?
What is the basic syntax of a linq query in visual basic as well as in c#?
Does java have linq?
Explain what is the difference between statement lambda and expression lambda?
Can we use linq to query against a datatable?
What is difference between XElement.Load() and XDocument.Load()?
What is the difference between LINQ and Lambda Expression?
1 Answers Petranics Solutions,
How is linq useful than stored procedures?
What is the advantage of linq over sql?
What is linq query in c#?
What is linq placement?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)