I was wondering if there is any concurrency (now or future), or performance benefit to using yield return over returning a list. See the following examples
Processing Method
void Page_Load()
{
foreach(var item in GetPostedItems())
Process(item);
}
using yield return
IEnumerable<string> GetPostedItems()
{
yield return Item1.Text;
yield return Item2.Text;
yield return Item3.Text;
}
returning a list
IEnumerable<string> GetPostedItems()
{
var list = new List<string>();
list.Add(Item1.Text);
list.Add(Item2.Text);
list.Add(Item3.Text);
return list;
}