Join Olivia Chiu Stone for an in-depth discussion in this video Queries that change the source type, part of LINQ with C# Essential Training.
- When a query transforms the data type…determining type relationships…can get complex.…This example takes a specific property…from each of the elements in the source…to create the resulting sequence.…Looking at the same variables as before…there are three things to notice here…that leads to a transformation in our resulting sequence.…First, the source type has remained the same.…So the range variable cust in the query…is so of the type Customer.…The type of the data that is selected…determines the type of the query variable.…
In this case the query will only be returning…the last names of the customers that are in Oregon.…The Last property in the customer object…is of the type string.…Therefore the query variable has a type…IEnumerable<string>.…Finally since the resulting sequence from…the query is a string the iteration variable…to be used in the for each statement…must also be a string.…Since I am only taking the last property…from each customer element the source…is transformed from a list of customer objects…
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.