From the course: Complete Guide to .NET LINQ: Querying Collections, Databases, and Markup
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Use Where to compare values
From the course: Complete Guide to .NET LINQ: Querying Collections, Databases, and Markup
Use Where to compare values
- [Instructor] In this example, we're continuing to explore how to use the where clause in a link query. This time filtering based on a value of an XML element rather than an attribute. The structure of the query is similar to what we've seen before. We're starting by selecting all the cards, and then I'm drilling down to get the BidPrice element, so this'll be the element that I want for my source. Then here I am going to define another variable called bidParsed that is a decimal value. So I'm taking the string value and converting it to a decimal. Then I can use this code right here where bidParsed is greater than 12.00. So this is numeric and this is numeric. Now here when I select out my type, I'm selecting out the card name and then the BidPrice. And you can see here, this is a string and this is a decimal. Now, what I'm going to do in the next example is create a calculated column based on the BidPrice and the CatalogPrice. So we have the catalog, which is the original price of…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Use Query syntax to work with elements4m 59s
-
(Locked)
Query element values in XML1m 10s
-
(Locked)
Query attributes in XML1m 56s
-
(Locked)
Project data into an anonymous type4m 10s
-
(Locked)
Filter by attribute value with Where1m 52s
-
(Locked)
Use Where to compare values2m 10s
-
(Locked)
Perform aggregate queries in XML1m 26s
-
(Locked)
Sort query results with OrderBy3m 29s
-
(Locked)
Find empty elements and blank values4m 51s
-
(Locked)
Group XML data with GroupBy3m 48s
-
(Locked)
Challenge: Create a custom string output1m 50s
-
(Locked)
Solution: Create a custom string output1m 19s
-
(Locked)
Challenge: Filter elements with no content52s
-
(Locked)
Solution: Filter elements with no content51s
-
(Locked)
Challenge: Filter results for invalid values1m 28s
-
(Locked)
Solution: Filter results for invalid values1m 54s
-
(Locked)
-
-