Prev | Current Page 100 | Next

Satheesh, N Kumar

"LINQ Quickly"

Add
some more ice-creams' details for better understandable results of the following
queries. All of the operators that we use in queries are defined under the
System.Linq namespace.
We will build a query to fetch ice-creams from the above list that have a price value
equal to 10. We will also display the results by giving the flavours in order, and all
the names in uppercase letters. Following is the query to get the result using the
where, select, and OrderBy operators. We have also used the direct method
Chapter 3
[ 61 ]
ToUpper() to change all the letters to uppercase. The result will contain a list of
ice-creams, ordered according to the flavour, as the Orderby operator is used against
the element Flavour.
XElement IcecreamsList = new XElement("IcecreamsList",
(from c in Icecreams.Elements("Icecream")
where (c.Element("Price").Value == "10")
orderby c.Element("Flavour").Value select new XElement("Icecream",
c.Element("Flavour").Value.ToUpper())));
Let us assume the above query returns ten records.


Pages:
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
Tango Olsztyn katalog stron katalog stron zdjęcia ślubne warszawa Donica