An Enum has a default value. This corresponds to the value that equals 0 within the Enum type, which is by default the first listed one. When part of a class, an Enum does not need initialization to this default value.
The default values of an enum proceed up from 0.
So the first is zero,
the second is one,
and the third is two. Initializing an Enum to zero is a performance negative. It will result in additional yet unneeded steps.
VB.NET program that uses Enum, default value
Module Module1 Enum Level Normal Low High End Enum Class Item ''' <summary> ''' Public enum. ''' </summary> Public _level As Level End Class Sub Main() ' The default value for an enum is the one equal to 0. Dim v As Item = New Item Console.WriteLine(v._level.ToString()) End Sub End Module Output Normal
|Clone Visual studio 2013 solution||5||25|
|Open a word document||23||33|
|Help with concatenating data from one data element to another using VB.NET||3||33|
|VB.Net - Windows UserName index and length error||4||22|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
21 Experts available now in Live!