What is the cheapest way to execute a LINQ-Query immediately

后端 未结 2 1916
萌比男神i
萌比男神i 2021-01-23 05:17

This question came into my mind while generating sample data for a SO-answer. I don\'t like the verbose way of adding DataRows one by one via Tbl.Rows.Add, so i\'ve

2条回答
  •  别那么骄傲
    2021-01-23 05:51

    I'd just rewrite it as a foreach:

    For Each y As String in years
        tbl.Rows.Add(y)
    Next
    

    It's much more clear what your intention is this way, and it executes right away.

提交回复
热议问题