What is the yield keyword used for in C#?

后端 未结 17 1690
盖世英雄少女心
盖世英雄少女心 2020-11-22 05:26

In the How Can I Expose Only a Fragment of IList<> question one of the answers had the following code snippet:

IEnumerable FilteredList()
{
         


        
      
      
      
17条回答
  •  悲&欢浪女
    2020-11-22 05:57

    It's producing enumerable sequence. What it does is actually creating local IEnumerable sequence and returning it as a method result

提交回复
热议问题