The goto Statement

In true C and C++ style, C# provides a goto statement to perform unconditional control transfer to a point in the code marked by a label. The greatest computer scientists have debated the use of goto for years:

Image Edsger Dijkstra, a Dutch computer scientist, published his infamous paper “Go To Statement Considered Harmful” in 1968. At that time, structured programming (if, while, and so on) was gaining popularity, and most typical cases of goto got eliminated by it. And true, use of goto all over the place quickly results in spaghetti code.

Donald Knuth, known for his “The Art of Computer Programming” series, stated this viewpoint ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.