में विभिन्न LINQ उत्तर निम्नलिखित वीएस 2010 में 2 और वीएस 2012 में 2 के रूप में उत्तर देता है। मुझे व्यक्तिगत रूप से लगता है कि यह होना चाहिए 2. मुझे यकीन नहीं है कि यहां क्या हो रहा है।वीएस 2010 और वीएस 2012
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
namespace _335ExamPreparation
{
public class Doubts
{
int[] nums = { 10, 11, 12, 13, 14, 15, 16 };
int[] divisors = { 7, 10 };
static void Main(string[] args)
{
Doubts d = new Doubts();
d.func();
}
public void func()
{
var m = Enumerable.Empty<int>();
foreach (int d in divisors)
{
m = m.Concat(nums.Where(s => (s % d == 0)));
}
int count = m.Distinct().Count();
Console.WriteLine(count);
}
}
}
धन्यवाद।
रिशेर्पर चेतावनी: संशोधित बंद करने के लिए उपयोग –