Can I conditionally compile "Select Case"?

The MSDN article on #If Then #Else( https://msdn.microsoft.com/en-us/library/tx6yas69.aspx ) gives me the basics of conditional compilation of conditional statements.

I have more lists of declarations that need to be initialized in different ways, based on several platforms. Should I use #ElseIfat compile time or is there an option #Select Casetoo?

+4
source share
1 answer

There are no directives #Select Casein VB.Net ( as indicated by Icepickle )

#Const .

/, ,

, , :

Public Interface IPlatformDependant
    Property Test1 As Integer
    'Define here all the parameters used by your application
End Interface

platform1.vb:

#If Platform = 1
    'The code for the first platform
    Public Class PlatformDependant
        Implements IPlatformDependant

        Public Property Test1 As Integer Implements IPlatformDependant.Test1

    End Class
#End If

platform2.vb:

#If Platform = 2
    'The code for the second platform
    Public Class PlatformDependant
        Implements IPlatformDependant

        Public Property Test1 As Integer Implements IPlatformDependant.Test1

    End Class
#End If

platform, , PlatformDependant . ...

, , .

+1

Source: https://habr.com/ru/post/1664207/


All Articles