Please read the code and answer question below:
class Program
{
static void Main(string[] args)
{
IEnumerable<int> myEnum = Data().Where(it => it < 5);
string site = "http://msprogrammer.serviciipeweb.ro/";
int[] arr = myEnum.ToArray();
site +=" number is "+ myEnum.Count();
site += " number is " + myEnum.Count();
Console.WriteLine(site);
}
static IEnumerable<int> Data()
{
int i = 5;
i++;
yield return i;
yield return (i+7);
}
}
How many times the breakpoint at
int i = 5;
will be hit ?
Why?
And if your answer is not 3,please look at https://youtu.be/1fy_T9TCPpc
Leave a Reply