Next, below the preceding line, you'll make a decimal
array called salaries
, naturally enough. So, enter the following:
decimal[] salaries = new decimal[] { 56789, 78888, 35555, 34533, 75000 };
This is how you can query a decimal
array. This is a decimal
array specifically, but it could be any array essentially. We throw in some values, and there you go.
Next, enter the following below this line:
IEnumerable<string> salResults = from salary in salaries
Notice that the return or results set will be of the string
type, not of the decimal
type. After salResults =
, you want to define the body of the LINQ queries, so you say from salary in salaries
. If you hover your mouse over salary
here, you see that it is what is known as a range variable, shown in figure 11.6.2. So, you're asking it to take a look in salaries
. As a range variable, it's the quantity that goes over all of the entries individually.
Figure 11.6.2: Range variable