Is there ever a reason to use goto in modern .NET code?

前端 未结 19 1693
野性不改
野性不改 2020-12-08 14:19

I just found this code in reflector in the .NET base libraries...

    if (this._PasswordStrengthRegularExpression != null)
    {
        this._PasswordStreng         


        
19条回答
  •  死守一世寂寞
    2020-12-08 14:47

    I'm not crazy about gotos, but to say that they're never valid is silly.

    I used one once to fix a defect in a particularly messy piece of code. To refactor the code and test it would not have been practical given the time constraint.

    Besides, haven't we all seen conditional constructs that were so poorly coded that they make gotos seem benign?

提交回复
热议问题