Convert from VB.net to C# Enumeration select case

  • Thread starter Thread starter Claudio111
  • Start date Start date
C

Claudio111

Guest
Hi All

I need to connvert in C# the following code (I use WinForm)

In a VB.net Library there is an Enumeration of texgBox TAGs in a Module (MOD1)


Public Module Mod1

Public Enum TagList
AN '- accetta caratteri stampabili
AA '- accetta solo lettere
DB '- nome per database
NIP '- accetta solo numeri interi positivi
NI '- accetta numeri interi positivi e negativi
NDP '- accetta numeri decimali solo positivi
ND '- accetta numeri decimali e interi positivi o negativi
end Enum

End Module


Then in a Sub in C# I have to check a Tag value from TextBox (MyTag in the followin code)

How to convert in C# the following VB.net Code ?

Dim EnumValTag = DirectCast([Enum].Parse(GetType(TagList), MyTag), TagList)

Select Case EnumValTag

Case TagList.AN, TagList.AA

' do something


Case Else
' do something else

End Select


Thanks for Help

Continue reading...
 
Back
Top