Empty

In this chapter you will learn:

  1. How to use Empty operator

Get to know Empty operator

Empty creates an empty sequence and requires just a type argument:

using System;/* j  a v a2s .  c o  m*/
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        foreach (string s in Enumerable.Empty<string>())
        {
            Console.Write(s); // <nothing>
        }
    }
}

Next chapter...

What you will learn in the next chapter:

  1. How to use Except operator
  2. Except with String array
Home » C# Tutorial » Linq Operators
Aggregate
Aggregate with seed
Aggregate string value
All
Any
Average
Cast
Concat
Contains
Count
DefaultIfEmpty
Distinct
ElementAt
ElementAtOrDefault
Empty
Except
FindAll
First
FirstOrDefault
GroupBy
Intersect
Last
LastOrDefault
LongCount
Max
Min
OfType
OrderBy
OrderByDescending
Range
Repeat
Reverse
SelectMany
SequenceEqual
Single
SingleOrDefault
Skip
SkipWhile
Sum
Take
TakeWhile
ThenBy
ThenByDescending
ToArray
ToList
Zip