CSharp - Empty for PLINQ

Introduction

The static ParallelEnumerable.Empty method creates a ParallelQuery<T> that contains no items.

You specify the type T of the ParallelQuery <T> by calling Empty<T>().

To create a ParallelQuery<string>, you would call Empty<string>().

Prototypes

public static ParallelQuery<T> Empty<TResult>();

Demo

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program/*from w  w  w  . j  ava2s.c  o  m*/
{
    static void Main(string[] args)
    {
        ParallelQuery<int> pq = ParallelEnumerable.Empty<int>();

        foreach (int i in pq)
        {
            Console.WriteLine("Value {0}", i);
        }
    }
}