What is the use of labels in C#?

前端 未结 13 2167
面向向阳花
面向向阳花 2020-12-17 20:18

Labels and GOTOs are considered bad practice and as far as I know there is no reason to use it in C#.

What is the use of labels in C#?

相关标签:
13条回答
  • 2020-12-17 21:21

    I read somewhere, goto in most cases should just be use for jumping forward, so most likely just for early loop terminations and for continuing the outer loop since there are no labeled loops in C# (unlike Java). And there are some algorithms that can be elegantly expressed with goto than doing it the structured way.

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