instructies voor #Disable en #Enable (Visual Basic)

De #Disable en instructies zijn De richtlijnen van #Enable de Visual Basic-broncodecompilator. Ze worden gebruikt om alle of specifieke waarschuwingen voor coderegio's uit te schakelen en opnieuw in te schakelen.

    Dim variable1    'warning BC42024: Unused local variable: 'variable1'.
#Disable Warning
    Dim variable2    'no warning
#Enable Warning
    Dim variable3    'warning BC42024: Unused local variable: 'variable3'.
' Suppress warning about no awaits in this method.
#Disable Warning BC42356
    Async Function TestAsync() As Task
        Console.WriteLine("testing")
    End Function
#Enable Warning BC42356

U kunt ook een door komma's gescheiden lijst met waarschuwingscodes uitschakelen en inschakelen.

Zie ook