C# - AsEnumerable Example

前端 未结 9 1326
耶瑟儿~
耶瑟儿~ 2020-12-20 00:44

What is the exact use of AsEnumerable? Will it change non-enumerable collection to enumerable collection?.Please give me a simple example.

9条回答
  •  时光说笑
    2020-12-20 01:06

    No it doesn't change a non-enumerable collection to an enumerable one. What is does it return the collection back to you as an IEnumerable so that you can use it as an enumerable. That way you can use the object in conjunction with IEnumerable extensions and be treated as such.

提交回复
热议问题