Method-Based Query Syntax Examples: Element Operators

 

The examples in this topic demonstrate how to use the First method to query the AdventureWorks Sales Model using method-based query syntax. The AdventureWorks Sales Model used in these examples is built from the Contact, Address, Product, SalesOrderHeader, and SalesOrderDetail tables in the AdventureWorks sample database.

The example in this topic uses the following using/Imports statements:

[!CODE [DP L2E Examples#ImportsUsing](../CodeSnippet/VS_Snippets_Data/DP L2E Examples#importsusing)]

Example

The following example uses the First method to find the first e-mail address that starts with 'caroline'.

[!CODE [DP L2E Examples#FirstCondition_MQ](../CodeSnippet/VS_Snippets_Data/DP L2E Examples#firstcondition_mq)]

Queries in LINQ to Entities

Show: