1

私はそれに似たコードを持っています:

Using conn As OdbcConnection = getNewConnection()

'' Some code

If breakFlag Then
     canExit = True
     GoTo exitUpdate
End If

exitUpdate:
End Using

GOTO文をなくしたい。
そのため、ExitUsing コマンドがあると便利ですが、まだありません。

同様の状況で Using ブロックを終了するための良い方法はありますか、それともコードを別の方法で設計する必要がありますか?

4

1 に答える 1

2
Using conn As OdbcConnection = getNewConnection()
    '' Some code

    If breakFlag Then
         canExit = True
         ' remove this: GoTo exitUpdate
    ELSE
        ' here place the rest of your logic that would execute when breakflag = false
    End If
End Using
于 2013-11-04T13:23:49.247 に答える