How does foreach cast without explicit/implicit overrides?

后端 未结 1 641
粉色の甜心
粉色の甜心 2021-01-18 03:44

So I\'m just learning C#, and came across something that I find odd... I\'m playing with delegates and have creates a delegate DelegateReturnsInt. Now, When I use a

相关标签:
1条回答
  • 2021-01-18 04:08

    It does an implicit cast (if you look at the emitted IL, you'd see it). This also means you could get an unexpected cast exception on that line if it's not what you say it is.

    0 讨论(0)
提交回复
热议问题