Enumerable.Empty<'TResult> Method ()
Returns an empty IEnumerable<'T> that has the specified type argument.
Assembly: System.Core (in System.Core.dll)
Return ValueType: System.Collections.Generic.IEnumerable<'TResult>
An empty IEnumerable<'T> whose type argument is TResult.
The type to assign to the type parameter of the returned generic IEnumerable<'T>.
Themethod caches an empty sequence of type TResult. When the object it returns is enumerated, it yields no elements.
In some cases, this method is useful for passing an empty sequence to a user-defined method that takes an IEnumerable<'T>. It can also be used to generate a neutral element for methods such as Union<'TSource>. See the Example section for an example of this use of .
The following code example demonstrates how to use IEnumerable<'T>.to generate an empty
The following code example demonstrates a possible application of the Aggregate<'TSource> method is applied to a collection of string arrays. The elements of each array in the collection are added to the resulting IEnumerable<'T> only if that array contains four or more elements. is used to generate the seed value for Aggregate<'TSource> because if no array in the collection has four or more elements, only the empty sequence is returned.method. The
Available since 8
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1