What is the exact use of AsEnumerable? Will it change non-enumerable collection to enumerable collection?.Please give me a simple example.
Nobody has mentioned this for some reason, but observe that something.AsEnumerable()
is equivalent to (IEnumerable
. The difference is that the cast requires the type of the elements to be specified explicitly, which is, of course, inconvenient. For me, that's the main reason to use AsEnumerable()
instead of the cast.