Tuesday, March 27, 2012

Return empty IEnumerable<T> in C sharp

In order to return empty IEnumerable  in csharp you can use static Empty<T>() method in Enumerable class.

Suppose i have custom class called Foo  then,

Enumerable.Empty<Foo>();

No comments:

Post a Comment