Saturday, August 30, 2014

IEnumerable Syntactic Sugar Proposal

Hello,


There's no real need, you can just use LINQ to do it.



public static IEnumerable<int> GetNumber1()
{
return _numbers.Select(x => x);
}




public static IEnumerable<int> GetNumber2()
{
return from number in _numbers select number;
}



*
Bear in mind that this is equivalent in laziness but not in how it's implemented under the hood!




Cheers,


Eyal Shilony


You are free to contact me through 'msdn at shilony net' for anything related to the C# forum.




No comments:

Post a Comment