একাধিক তালিকা তৈরি করুন -
// two lists
var list1 = new List<int>{3, 4};
var list2 = new List<int>{1, 2, 3}; এখন, সাধারণ মানগুলি পেতে Intersect() পদ্ধতি ব্যবহার করুন −
var res = list1.Intersect(list2);
নিম্নলিখিত সম্পূর্ণ কোড -
উদাহরণ
using System.Collections.Generic;
using System.Linq;
using System;
public class Demo {
public static void Main() {
// two lists
var list1 = new List<int>{3, 4};
var list2 = new List<int>{1, 2, 3};
// common values
var res = list1.Intersect(list2);
foreach(int i in res) {
Console.WriteLine(i);
}
}
} আউটপুট
3