R
roel.schreurs
When I make an enumeration, the various values are accessed by
<enum_name>.<option1>. I noticed that each option has properties that
return any of the options in the enumeration, as can easily seen by
listing the members (typing a . after the expression). This way, you
can make expressions like:
<enum_name>.<option1>.<option2>.<option3>.<option1> e.t.c. The
expression takes on the value of the last option.
I was wondering what purpose these properties have. Does anybody know
this?
Below is an example made on an empty VB.NET Windows application. It
compiles and runs (doing very little of course).
'----------------------------
Option Strict On
Option Explicit On
Public Class Form1
Inherits System.Windows.Forms.Form
'(#Region " Windows Form Designer generated code ")
Private Enum MyEnum
FirstOption
SecondOption
ThirdOption
End Enum
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim test As MyEnum = MyEnum.FirstOption
Select Case test
Case
MyEnum.FirstOption.SecondOption.ThirdOption.ThirdOption.ThirdOption.FirstOption
Case MyEnum.SecondOption
Case MyEnum.ThirdOption
End Select
End Sub
End Class
<enum_name>.<option1>. I noticed that each option has properties that
return any of the options in the enumeration, as can easily seen by
listing the members (typing a . after the expression). This way, you
can make expressions like:
<enum_name>.<option1>.<option2>.<option3>.<option1> e.t.c. The
expression takes on the value of the last option.
I was wondering what purpose these properties have. Does anybody know
this?
Below is an example made on an empty VB.NET Windows application. It
compiles and runs (doing very little of course).
'----------------------------
Option Strict On
Option Explicit On
Public Class Form1
Inherits System.Windows.Forms.Form
'(#Region " Windows Form Designer generated code ")
Private Enum MyEnum
FirstOption
SecondOption
ThirdOption
End Enum
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim test As MyEnum = MyEnum.FirstOption
Select Case test
Case
MyEnum.FirstOption.SecondOption.ThirdOption.ThirdOption.ThirdOption.FirstOption
Case MyEnum.SecondOption
Case MyEnum.ThirdOption
End Select
End Sub
End Class