Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
C# Tutorial
LINQ 429 codes
Home
C# Tutorial
LINQ
1 A deferred execution query is reevaluated when you reenumerate
2 A lambda expression can reference the local variables and parameters of the method in which its defined
3 A lambda expression has the following BNF form
4 A local variable instantiated within a lambda expression is unique per invocation of the delegate instance
5 A More Complex Example of the First SelectMany
6 A query to extract strings containing the letter a, sorted by length and converted to uppercase
7 A Query Using the Standard Dot Notation Syntax
8 A subquery is a query contained within another querys lambda expression
9 Accumulator function
10 Add Extension method
11 Add extension to Func
12 Adding new line character to selected value
13 Aggregate and Sum
14 Aggregate for string length
15 Aggregate Prototype
16 Aggregate string and int value
17 Aggregate three values
18 Aggregate two string values
19 Aggregation with integer value
20 Aggregation with string value
21 All employees in a tree are grouped by department
22 All method
23 All with condition
24 All with Predicate to Return True
25 All with string length
26 An Anonymous Type Assigned to a Variable Declared with the var Keyword
27 An array of string values sorted first by length, then sorted alphabetically, using a case-insentive comparison
28 An Example Calling the Reverse Operator
29 An Example of Collection Initialization
30 An untidy nested query
31 Anonymous Method
32 Anonymous Type
33 Anonymous Type In Array
34 Anonymous Types
35 Any method
36 Any operator with an string array
37 Any with condition
38 Any with false predicate
39 Any with string operator
40 Array of anonymous types
41 ArrayList Query
42 Assign the loop variable to another variable declared inside the statement block
43 Automatic properties
44 Average with int array
45 Build the necessary Func delegates using anonymous methods
46 Call ILookUp returned from ToLookup to get the IEnumerable
47 Call LastOrDefault returned from Take
48 Calling the Common Library Filter Method
49 Calling the ElementAt Operator
50 Calling the Filter Method with a Lambda Expression
51 Calling the Filter Method with an Anonymous Method
52 Calling the First ToDictionary Prototype
53 Calling the Range Operator
54 Calling the ToArray Operator
55 Calling the ToList Operator
56 Calling ToList
57 Cars going faster than 55, ordered by PetName
58 Cartesian Join demo
59 Cast to BinaryExpression
60 Cast to ParameterExpression
61 Chaining Query Operatorsextracts all strings containing the letter a, sorts them by length, and then converts the results to uppercas
62 Compiled Expression Tree
63 Complex Query Using Method Syntax
64 Compound from
65 Concat appends one sequence to another
66 Concat Prototype
67 Concatenate one array to another
68 Concatention by Using the Concat Operator
69 Concise Lambda Expression
70 Conditional Count
71 Conduct query on the result again
72 Construct instance for nested class
73 Constructor new object with select statement
74 Contains with IEqualityComparer
75 Contains with predicate returned false
76 Contains with string value
77 Contains with string value and IEqualityComparer
78 Contains, Any return a bool value
79 Convert an ArrayList to an IEnumerableT That Can Be Used with the Typical Standard Query Operators
80 Convert Query result to a List
81 Convert query result to an Array
82 Convert query to array
83 Convert query to array with ToArray
84 Convert query to Dictionary
85 Converting an Array of Strings to Integers
86 Converting an Array of Strings to Integers and Sorting It
87 Count elements in a Range
88 Count with string operator
89 Count with string value
90 Create and initialize the list of Simple type with new syntax
91 Create new object from query
92 Create struct for Collection with new syntax
93 Create the All query
94 Create the Distinct query
95 Create the Except query
96 Create the Intersect query
97 Create the Union query
98 Data Filtering And Sorting
99 DefaultIfEmpty Demo
100 Deferred Query Execution
101 Define the query using IndexArray first
102 Define the query using two from keywords
103 Delegate targets
104 Demonstrating the Query Results Changing Between Enumerations
105 Display Linq result in a DataGridView
106 Display Products With Unknown Price
107 Distinct Operator
108 Double recursive extension
109 ElementAtOrDefault Operator with a Valid Index
110 ElementAtOrDefault Operator with an Invalid Index
111 Except Prototype
112 Explicit Range Variable
113 Expression Tree
114 Extension method for integer
115 Extension Methods Discoverability
116 Filter by Make and Speed
117 Filter string by its length
118 Filtered
119 Filtering with OfType
120 First Min Prototype
121 First operator
122 First OrderBy Prototype
123 First OrderByDescending Prototype
124 First Select Prototype
125 First ThenBy Prototype
126 First ThenByDescending Prototype
127 First with string method
128 FirstOrDefault
129 FirstOrDefault returns null when an Element Is Found
130 FirstOrDefault with a Not Found Element
131 FirstOrDefault with Condition
132 FirstOrDefault with string operator
133 From Assignment
134 Generating an array of double values by first using a query expression with orderby
135 Get a customer in Africa with FirstOrDefault
136 Get all Make and dont show duplicates
137 Get all reversed cars
138 Get Distinct departments
139 Get Distinct departments with condition
140 Get last element
141 Get the 5th element
142 Get the first element
143 Get the first four element in the list
144 Get the Min and max value from a query
145 Get upper case chars
146 Group Query
147 Group words by length
148 GroupBy partitions a list of numbers by their remainder when divided by 5
149 Grouped Average
150 Grouped Max
151 Grouped Min
152 Grouped Sum
153 Grouping by substring
154 GroupJoin Operator
155 How queries can be executed immediately with operators such as ToList()
156 Ice Creams with price less than 10
157 Icecreams with Least Price
158 If your querys lambda expressions reference local variables, these variables are subject to outer variable semantics
159 Immediate Query Execution
160 Implicit Local Variables with Anonymous Types
161 Instantiating and Initializing an Anonymous Type Using Object Initialization
162 Intersect Operator
163 Join on substring
164 Join Operator
165 Join Query
166 Join three object list
167 Join two object lists
168 Lambda Expression
169 Lambda Expression for Func
170 Lambda Expression To Expression Tree
171 Lambda Expression to retrieve string length
172 Lambda expression used to declare a delegate
173 Lambda expression used to declare an expression tree
174 Lambda Expression With Parameters To Expression Tree
175 Last Prototype
176 Last with string operator
177 LastOrDefault
178 LastOrDefault returns null when an Element Is Found
179 LastOrDefault with string operator
180 LINQ Method Syntax
181 LINQ query to get strings starting with s
182 LINQ to DataSet
183 Linq over array
184 Linq Over Array Using Sequence
185 Linq Over ArrayList
186 Linq To Objects
187 Linq To Sql
188 List Sort With Lambda Expression
189 LongCount Prototype
190 LongCount with &&(and) operator
191 Max on int array
192 Max on object list
193 Max on Object list array
194 Max on String array
195 Min with object property
196 Min with string property value
197 Min with string value
198 Modifying Where Behavior
199 Most query operators is that they execute not when constructed, but when enumerated
200 Multi Level Ordering
201 Multiple from
202 Nested Count
203 Nested query list
204 Nested Skip
205 Nested Take
206 Not in Top Five Customers by Sales
207 Numeric Aggregates
208 Object Initializer
209 OfType
210 One array expect another array
211 Order by descending
212 Order Method Syntax
213 Order Query Results
214 OrderBy
215 OrderBy joined value
216 OrderBy with customized Comparer
217 OrderBy with passing a lambda function
218 OrderByDescending and ThenBy
219 Ordered by PetName
220 Overloading By Delegate Return Type
221 Partition with TakeWhile
222 Partitioning Operators
223 Partitions an array of words into groups according to the first letter of each word
224 Pass the delegates into the methods of Sequence
225 Printing the customer number and orderID for every order in the list
226 Printing the unique Category names
227 Prints a list of numbers that are common to two integer arrays
228 Prints all of the elements of an array that are of type double
229 Prints strings where each element has the second letter i
230 Prints the first letter of a Product name and the first letter of a Customer name
231 Prints the unique elements of two integer arrays
232 Prints unique letters from Product and Customer names
233 Products sorted alphabetically by the product name
234 Products sorted by the number of units of each product that are in stock
235 Projection Creates New Objects
236 Projection Linq
237 Projection Operators
238 Query a list of objects by its property
239 Query a List or objects and create new objects
240 Query an array of object by its property value
241 Query by Persons FirstName
242 Query by position
243 Query by string length with Linq
244 Query Expression
245 Query for filtering numbers
246 Query Reuse
247 Query string value by String StartsWith
248 Query Using the Query Expression Syntax
249 Query with an Exception
250 Query with extension methods
251 Query with Intentional Exception Deferred Until Enumeration
252 Range Cartesian Join
253 Range Enumeration
254 Range Filtering
255 Range Ordering
256 Range Projection
257 Range Reversal
258 Reflecting result from Linq
259 Restriction Operators
260 Retrieving all strings in an array whose length matches that of the shortest string
261 Return a lambda function
262 Return an Empty Sequence of Strings
263 Return From Anonymous Method
264 Returning a List
265 Returning a Sequence of Ten Integers All With the Value Two
266 Reverse does exactly as it says
267 Search Customers by first name
268 Second Select Prototype
269 Second SkipWhile Prototype
270 Second ToDictionary
271 Select - Indexed
272 Select all from a List
273 Select array item by type
274 Select Distinct
275 Select from a Group
276 Select new clause
277 Select new value
278 Select object in a List
279 Select only pet name
280 Select Prototype
281 Select sum value
282 Select with Anonymous Types
283 SelectMany Prototype
284 SequenceEqual Operator
285 SequenceEqual Operator with string array
286 SequenceEqual Operator with Take and Count
287 SequenceEqual Operator with Take, Concat and Skip
288 Set Operators
289 Shows how queries can be reused
290 Simple Anonymous Methods for calculating the mean value
291 Simple Anonymous Methods for printing out reverse numbers
292 Simple Anonymous Methods for printing the square root
293 Simple Join
294 Simple Let Example
295 Simple linq
296 Simple Linq to SQL
297 Simple method based query
298 Single with condition
299 Single with object list
300 SingleOrDefault
301 SingleOrDefault after where clause
302 SingleOrDefault with object property reference
303 Skip numbes equals 50
304 Skip the first element
305 Skip the first four
306 SkipWhile Prototype
307 SkipWhile with condition
308 SkipWhile with index
309 Sort object by its property
310 Sorted alphabetically in descending order, using a case insensitive comparision
311 Sorted join query
312 Sorting strings in a file
313 Square is assigned the lambda expression x = x x
314 String array sorted by the length each element
315 Sum with integers
316 Sum with object property
317 Sum with Projection
318 Take and SelectMany
319 Take method
320 Take numbers equals 50
321 Take operator outputs the first x elements, discarding the rest
322 TakeWhile with condition
323 TakeWhile with expresion
324 TakeWhile with two parameters
325 The aggregation operators return a scalar value
326 The element operators extract one element from the input sequence
327 The Skip operator ignores the first x elements and outputs the rest
328 The standard object creation and initialization vs Linq
329 To List
330 To remove all vowels from a string
331 ToDictionary
332 ToDictionary for an object list
333 ToDictionary with IEqualityComparer
334 ToLookup Demo
335 ToLookup with int and string
336 Top Five Customers by Sales
337 Transformation
338 Two where clauses
339 Union does appends one sequence to another with duplicates removed
340 Union Operator
341 Use && in where clause
342 Use == in join
343 Use a LINQ query to find the public enums
344 Use Aggregate on an array
345 Use Aggregate on an array with tenary operator
346 Use Aggregate Operators
347 Use an indexed Where clause (where the length of the numbers name is shorter than its value)
348 Use Contains to check the existance of an element
349 Use Contains, Length and ToUpper from Linq
350 Use Conversion Operators ToArray
351 Use delegate to create a filter
352 Use ElementAt to print the fourth number less that 5 in an integer array
353 Use Equal determines if two string arrays have the same elements in the same order
354 Use Except to print numbers that are in one integer array, but not another
355 Use Except to print the first character of product names that arent also the first character of customer names
356 Use First to return the first matching element as a Product
357 Use First, Last with expression
358 Use foreach loop to deal with the result from linq
359 Use from where select to choose the Employees in the IT department from a tree
360 Use function in where clause
361 Use Generation Operators
362 Use Group By
363 Use index when querying array with LINQ
364 Use join key word
365 Use Join on
366 Use LastOrDefault
367 Use LINQ to get Employees in the IT department from a tree
368 Use LINQ to query characters in a string
369 Use LINQ to SQL
370 Use LINQ with Dictionary
371 Use Linq Aggregate the reverse a string
372 Use Linq Distinct to get the distinct value in an array
373 Use Linq OfType to get value of specific type
374 Use Linq Sum to sum an array
375 Use Linq to union two arrays
376 Use Quantifiers
377 Use select to retrieve all nodes in a Binary tree
378 Use SingleOrDefault
379 Use Skip
380 Use SkipWhile with index
381 Use static method syntax to call the query operators
382 Use string method in where clause
383 Use Sum to find the total of all of the numbers in an integer array
384 Use Take
385 Use TakeWhile with index
386 Use ToLookup to search object property
387 Use where to filer object list
388 Uses group by to partition a list of each customers orders, first by year, and then by month
389 Uses group by to partition a list of products by category
390 Uses GroupBy to partition trimmed elements of an array using a custom comparer
391 Uses Max to get the length of the longest word in a string array
392 Uses Skip to get all but the first 4 elements of the array
393 Using a compound from clause to select all orders where the order was made in 1998 or later
394 Using a compound orderby to sort a list of digits first by length of their name, and then alphabetically
395 Using a compound orderby to sort a list of products, first by category, and then by unit price, from highest to lowest
396 Using a subquery to sort String
397 Using All to determine whether an array contains only odd numbers
398 Using an OrderBy and a ThenBy clause with a custom comparer to sort first by word length and then by a case-insensitive descending so
399 Using Anonymous Methods with Find
400 Using Average method to calculate the average value from a query
401 Using Average to get the average length of the words in the string array
402 Using Average to get the average of all values of an integer array
403 Using Concat to merge the names of all customers and products
404 Using Concat to merge two integer arrays into a single sequence
405 Using Concat with array elements
406 Using DefaultIfEmpty in Where clause
407 Using ElementAt
408 Using ElementAtOrDefault
409 Using FirstOrDefault
410 Using group to group all employees by department
411 Using Lambda Expressions with Find method
412 Using Linq Cast to convert array to IEnumerable
413 Using Linq Intersect to intersect two arrays
414 Using Linq to get all methods
415 Using Max to get the highest number in an integer array
416 Using Min to get the length of the shortest word in a string array
417 Using Min to get the lowest number in an integer array
418 Using orderby clause to order result
419 Using Repeat to generate a sequence that contains the number 7 ten times
420 Using select to create a sequence of each product name
421 Using Single
422 Using var
423 Using where clause in a while loop
424 Where by Prototype
425 Where clause
426 Where clause with string method and return IEnumerable object
427 Where Prototype
428 Where with OrderBy
429 Without Using DefaultIfEmpty