Sunday, July 17, 2011

Goto statement used in .net framework

From the very beginning of the C,C++ and C# days it was told that using goto keyword is not a good practice .Most of the developers are following the same too.They spent little more time in their C# career starting time to avoid goto statements if they are from goto programming world.

But today I happened to see a goto statement not really couple of goto statements in the .net framework. Actually I was searching for a mechanism to parse a string of sql statement and create select command out of that.So obviously I entered in the SQLCommandBuilder class and started reflecting the GetUpdateCommand.After digging into inner methods I saw couple of goto keywords in a private method of DBCommandBuilder.BuildUpdateCommand. Can't you believe? See the below screen shot. I am using .net 3.5.So the framework version shows 2.0.

Is it the problem of reflector disassembling the IL? Or written as it is. Who knows...

No comments: