SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 130 | Next

Scott Klein

"Professional LINQ"

UnitPrice;
listbox1.Items.Add(query.Sum());
The value returned from this query is 12955.4816. This query can also be written as the following:
var query =
from od in orderdetail
where od.SalesOrderID == 43662
select od;
listbox1.Items.Add(query.Sum(orderDetail => orderDetail.UnitPrice));
Which query you use is a matter of preference. There??™s no performance advantage between the two.
Set Operators
Set operators perform actions against elements or sequence sets, and then return a set. There are four
LINQ set query operators??”Distinct, Union, Intersect, and Except.
Distinct
The Distinct operator removes duplicate values from a collection and returns distinct elements from
that collection (or sequence).
In the following example, the list contains 13 numbers ranging from 1 to 10; some of the numbers
(1, 7, and 9) repeat. Applying the distinct operator removes the duplicates and returns only the
distinct values.
List quantity = new List {1, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10};
IEnumerable val = numbers.Distinct();
foreach (int num in val)
listbox1.


Pages:
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6