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

前端 未结 19 1673
野性不改
野性不改 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:38

    goto is perfectly valid for cleanup stuff in languages like C at least, where it somewhat simulates the notion of exceptions. I'm sure that .NET has better ways of handling stuff like this, so goto is just obsolete and error prone.

提交回复
热议问题