In order to understand functional coding, let's take a look at the difference between a "non-functional" for loop and a functional approach to achieve the same results. With our first sample, we have a "non-functional" approach with a basic "for" loop that produces the numbers [0,10] and display them to the console.
Beginning Code Sample:
for (Int32 i = 0; i < 10; i++)
Console.WriteLine(i);
Ok, let's get started looking at the different ways to implement this in a functional manner using the 2.0 and 3.5 frameworks. To accomplish the same thing with a functional coding style, we'll create a helper method (ForEach<T>) in order to perform an action _disibledevent=MsoBodyText>Until next time,
Happy coding
最新评论