Join Olivia Chiu Stone for an in-depth discussion in this video Perform operations on source elements, part of LINQ with C# Essential Training.
- In addition to using elements from a source sequence…to create a new sequence of a different type,…we can also transform our data…by performing operations on the elements themselves…to change their values or types.…I want to convert the value of the purchases…for each customer into a different currency, the Euro.…The values are currently in US Dollars.…So I'll need to perform a calculation…on the price property to convert the US Dollars…to Euros by multiplying by the exchange rate.…I'll use an exchange rate of 0.89…to go from US Dollars to Euros.…
I'll create a new query called inEurosQuery.…Introduce my data source,…and select the customer's name…and the price properties.…Before I assign a value to the new price property,…I'll convert the US price to Euros…by multiplying the value by 0.89…If for some reason,…the value needs to be a string rather than numeric,…I can add functionality to do that too.…
For simplicity, I'll leave the query as is.…To execute the query, I'll add a foreach statement.…The formula used can be as complicated as needed.…
AuthorOlivia Chiu Stone
In LINQ with C# Essential Training, engineer Olivia Chiu introduces techniques for querying, updating, and transforming data with LINQ. She covers standard queries—such as finding overlaps in two datasets and creating hierarchies—as well as complex chained queries. She also shows how to group and join LINQ queries with lambda expressions, and use LINQ to query SQL databases and XML documents. Last but not least, Olivia provides tips for optimizing the performance of your queries.
- Creating and executing a LINQ query
- Returning results
- Changing the data source type
- Performing standard queries
- Working with lambda expressions
- Chaining and complex queries
- Querying SQL and XML
- Performing tree queries
- Using sequences, elements, and scalars
- Allocating memory
Skill Level Intermediate
1. Introduction to LINQ
Common use cases1m 45s
2. Basic LINQ Queries
3. Data Transformation
Return results as a new type1m 39s
4. Type Relationships
5. Standard Queries
6. Lambda Expressions
7. Complex Queries
8. LINQ to SQL
9. LINQ to XML
10. Other Operators
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.