C# Tutorial Operator

Aggregate

  1. Aggregate string and int value in CSharp
  2. Aggregate two string values in CSharp
  3. Use Aggregate and Sum in CSharp
  4. Use Aggregate on an array in CSharp
  5. Use Aggregate on an array with tenary operator in CSharp
  6. Use Aggregate with for string length in CSharp
  7. Use Aggregate with meaningful variable names in CSharp

All

  1. Use All to check if an array has string elements who have four letters in CSharp

Any

  1. Get any string value containing " ei " in CSharp
  2. Use Any on empty string array in CSharp
  3. Use Any operator to check an attribute on an object in CSharp
  4. Use Any with condition in CSharp

Average

  1. Average an integer array in CSharp
  2. Average grouped values in CSharp
  3. Average length of the words in the string array in CSharp
  4. Average on results returned from a query in CSharp
  5. Average values from Enumerable.Range in CSharp

Cast

  1. Cast to int in CSharp
  2. Change value type when doing Sum in CSharp

Concat

  1. Combine SequenceEqual Operator with Take, Concat and Skip in CSharp
  2. Concat by not using the Concat Operator in CSharp
  3. Concat results returned from Take and Skip in CSharp
  4. Concat two int arrays in CSharp
  5. Find out the difference between Concat and Union in CSharp
  6. Use Concat to merge the names of all customers and products in CSharp

Contains

  1. Use Contains in LINQ query in CSharp
  2. Use Contains with string value and IEqualityComparer in CSharp

ConvertAll

  1. Convert object list to create new object list in CSharp

Count

  1. Count int value in int array in CSharp
  2. Count odd values in CSharp
  3. Count string starting with H in CSharp
  4. Count string values stored in an array in CSharp
  5. Select counted value in CSharp

DefaultIfEmpty

  1. Get default value for an object when no element is found in CSharp
  2. Get default value if the result is empty with DefaultIfEmpty in CSharp

Distinct

  1. Count distinct values in CSharp
  2. Get Distinct value from a string array in CSharp
  3. Use Linq Distinct to get the distinct value in an array in CSharp

ElementAt

  1. Get element at specific index in CSharp
  2. Get element at specific index or default value in CSharp
  3. Get element at specific position in CSharp
  4. Get object at specific index with ElementAt in CSharp
  5. Get the fourth number from a query in CSharp

Empty

  1. Return an Empty Sequence of Strings in CSharp

Except

  1. Do Except on two int arrays in CSharp
  2. Do Except on two object list returned from LINQ query in CSharp
  3. Do Except operation between two string arrays in CSharp
  4. Do Except operation on results from Take in CSharp

First

  1. Get first even element in an array in CSharp
  2. Get First matchec element as a list in CSharp
  3. Get strings whose length matches that of the shortest string in CSharp
  4. Get the first element in an array in CSharp
  5. Get the first even number or default value in CSharp
  6. Get the first or the default with empty array in CSharp

FirstOrDefault

  1. Get First Or Default for string starting with B in CSharp
  2. Get First Or Default on an array in CSharp
  3. Get First Or Default with a Not Found Element in CSharp
  4. Get First string starting with H in CSharp
  5. Use FirstOrDefault with an attribute from an object in CSharp

Intersect

  1. Insersect ID values from different tables in CSharp
  2. Intersect results from Take and Skip in CSharp
  3. Intersect results from two LINQ queries in CSharp
  4. Intersect two arrays in CSharp
  5. Intersect two string arrays in CSharp

Last

  1. Get last element in an array in CSharp
  2. Get last even element in an array in CSharp
  3. Get last or default for empty array in CSharp
  4. Get Last Or Default with consitions in CSharp
  5. Get Last string starting with H in CSharp
  6. Get the last element in an array in CSharp
  7. Get the last even number or default value in CSharp

LongCount

  1. Do LongCount with condition in CSharp

Max

  1. Get Max value after selecting in CSharp
  2. Get Max value in int array using LINQ in CSharp
  3. Get Max value in String array using LINQ in CSharp
  4. Get Max value on one attribute in object list using LINQ in CSharp
  5. Get the Min and max value from a query in CSharp
  6. Use Max function with grouped value in CSharp
  7. Use Max to get longest word in a string array by comparing length of the string in CSharp

Min

  1. Get Min on an attribute for a list of object in CSharp
  2. Get Min value after selecting in CSharp
  3. Get Min value from an int array in CSharp
  4. Get Min value from string value in CSharp
  5. Get Min value on grouped value in CSharp
  6. Get Min value on last name field in CSharp
  7. Use Min to get the shortest word in a string array by comparing string length in CSharp

OfType

  1. Filter Dictionary with OfType in CSharp
  2. Use Linq OfType to get value of specific type in CSharp

OrderBy

  1. Pass result from a LINQ to OrderBy method in CSharp
  2. Use OrderBy and ThenBy operators in CSharp

Range

  1. Filter a Range in CSharp
  2. Range Cartesian Join in CSharp
  3. Return int between 0 and 10 using Range in CSharp

Repeat

  1. Use Repeat to generate a sequence that contains the number 7 ten times in CSharp

Reverse

  1. Reverse an int array in CSharp
  2. Reverse an object array in CSharp
  3. Reverse an string array in CSharp
  4. Reverse a Range in CSharp
  5. Use Linq Aggregate to reverse a string in CSharp

SelectMany

  1. Project each element of a sequence to an IEnumerable, and flattens the resulting sequences in CSharp
  2. Take and SelectMany in CSharp
  3. Use SelectMany with inner LINQ statement in CSharp
  4. Use SelectMany with ? operator in CSharp

SequenceEqual

  1. Combine SequenceEqual Operator with Take and Count in CSharp
  2. Use SequenceEqual Operator to compare a string array with itself in CSharp
  3. Use SequenceEqual Operator with custom IEqualityComparer in CSharp

Single

  1. Get Single value from an object list in CSharp

SingleOrDefault

  1. Get one value or default value in case of no value with SingleOrDefault in CSharp
  2. Get only one value from a query with Single in CSharp

Skip

  1. Compare Skip 5 vs Take 5 in CSharp
  2. Skip by index and value length in CSharp
  3. Skip from the first element divisible by 3 in CSharp
  4. Skip numbers equals 50 in CSharp
  5. Skip the first element in CSharp
  6. Skip to ignore the first x elements and outputs the rest in CSharp
  7. Skip with string starting with A in CSharp
  8. Use SkipWhile to skip based on a user function in CSharp

Sort

  1. Add more sorting criteria with ThenByDescending in CSharp
  2. Sort a object array by string length in CSharp
  3. Sort string array by comparing substring in CSharp
  4. Use OrderByDescending to sort an string array in CSharp

StartsWith

  1. Has Any string starting with " J " in CSharp

Sum

  1. Sum an array in CSharp
  2. Sum integers from Enumerable.Range in CSharp
  3. Sum on grouped data in CSharp
  4. Sum on object property in CSharp
  5. Sum the string length in CSharp

Take

  1. Get LastOrDefault returned from Take in CSharp
  2. Get Top Five Customers by Sales in CSharp
  3. Take first 3 from a LINQ result in CSharp
  4. Take operator outputs the first x elements, discarding the rest in CSharp

TakeWhile

  1. Take strings whose length is less than 10 with TakeWhile in CSharp
  2. Take value less than 6 with TakeWhile in CSharp
  3. Use TakeWhile with index in CSharp
  4. Use value and index with TakeWhile in CSharp

ThenBy

  1. Use a ThenBy clause to add more ordering condition in CSharp
  2. Use custom IComparer with ThenBy clause in CSharp

ToArray

  1. Convert an Array of Strings to Integers in CSharp
  2. Convert list to array with ToArray in CSharp
  3. Convert query to array with ToArray in CSharp

ToDictionary

  1. Convert Object list to Dictionary in CSharp
  2. Convert query result to Dictionary in CSharp
  3. Convert query to Dictionary with Comparer in CSharp
  4. Convert query to Dictionary with ToDictionary in CSharp
  5. Use ToDictionary to provide formated data in CSharp
  6. Use ToDictionary with IEqualityComparer in CSharp

ToList

  1. Convert query result to list with ToList in CSharp
  2. Convert query result to list with ToList Operator in CSharp

Union

  1. Union Product names and Customer names in CSharp
  2. Union two int arrays in CSharp
  3. Union two string arrays in CSharp

Unique

  1. Find out Unique Category names in CSharp




















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ