क्वेरी करने योग्य संघ विधि का उपयोग करके दो अनुक्रमों पर संघ निष्पादित करें।
हमारे सरणियाँ निम्नलिखित हैं।
int[] arr1 = { 29, 40, 15, 55, 70, 30, 90 };
int[] arr2 = { 30, 36, 40, 18, 15, 55, 75 }; अब, संघ विधि का उपयोग करके सरणियों का संघ प्राप्त करें।
arr1.AsQueryable().Union(arr2);
उदाहरण
using System;
using System.Linq;
using System.Collections.Generic;
public class Demo {
public static void Main() {
int[] arr1 = { 29, 40, 15, 55, 70, 30, 90 };
int[] arr2 = { 30, 36, 40, 18, 15, 55, 75 };
IEnumerable<int> res = arr1.AsQueryable().Union(arr2);
foreach (int a in res)
Console.WriteLine("{0} ", a);
}
} आउटपुट
29 40 15 55 70 30 90 36 18 75