You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LINQ, or Language Integrated Query, is an integration of query capabilities as expressions of extension methods against data, such as in-memory data, document databases, or SQL databases.
12
+
</p>
13
+
<p>
14
+
Any collection class of type <code>IEnumerable</code> or <code>IQueryable</code> that uses the <code>DevNet\System\Extension\Tweak</code> to support the extension method can take advantage of using LINQ extension methods.
15
+
</p>
16
+
<p>
17
+
The difference between <code>IEnumerable</code> and <code>IQueryable</code> types is that the implementation of the <code>IEnumerable</code> type, like the <code>ArrayList</code>, uses LINQ against in-memory data, while the implementation of the <code>IQueryable</code> type, like the <code>EntitySet</code> repository of DevNet Entity ORM, uses LINQ against SQL database, which means that this one uses <code>IQueryProvider</code> to compile the predicate expressions of the LINQ methods to SQL query syntax.
18
+
</p>
19
+
<h3>Using LINQ extension methods</h3>
20
+
<p>
21
+
We use the <code>ArrayList</code> collection as an example to show you how to use the Linq extension methods with the <code>IEnumerable</code> collection and make sure to declare the namespace <code>DevNet\System\Linq</code> to be able to use those extension methods.
22
+
</p>
23
+
<pre><codeclass="language-php"><?php
24
+
25
+
// declaring the Linq namespace to be able to use the extension methods with the ArrayList instance.
26
+
use DevNet\System\Linq;
27
+
28
+
// creating ArrayList instance with generic type argument of Employee class.
29
+
$list = new ArrayList(Employee::class);
30
+
31
+
// assuming we have Employee class with constructor that initializes Id and Name properties.
0 commit comments