CSharp - Empty for PLINQ


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>().


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


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

class Program/*w  w w .j  a v  a2s.com*/
    static void Main(string[] args)
        ParallelQuery<int> pq = ParallelEnumerable.Empty<int>();

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