C# and .NET Fundamentals

Now that you have both tools working, let's take this small program apart line by line and examine the constructs it uses. In the next section, we'll review some features of C# and .NET, whose mastery is fundamental to Rx and LINQ.


Let's consider the program from the beginning. The first line could have been written as follows:

List<int> list = new List<int>( ) { 1, 2, 3, 5, 7, 11, 13 };

The results would have been identical. The advantages of the var keyword are that you avoid redundancy and that it is a bit terser. Further, there are times when you, as the programmer, may not know the type and letting the compiler infer the type (as is done with var) can be a tremendous time-saver—why look up the type when the ...

Get Programming Reactive Extensions and LINQ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.