all groups > vb.net > may 2004 >
You're in the

vb.net

group:

enum contain string


Re: enum contain string Armin Zingler
5/24/2004 6:36:45 PM
vb.net:
"Cc" <kobolds@singnet.com.sg> schrieb
[quoted text, click to view]

http://groups.google.com/groups?selm=OYUXFIY8DHA.3008%40TK2MSFTNGP09.phx.gbl

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Re: enum contain string hirf-spam-me-here NO[at]SPAM gmx.at
5/24/2004 6:37:18 PM
* "Cc" <kobolds@singnet.com.sg> scripsit:
[quoted text, click to view]

"No."

My FAQ:

\\\
Imports System.ComponentModel
Imports System.Reflection

..
..
..
MsgBox(GetDescription(Weekdays.Wed))
..
..
..

Private Enum Weekdays
<Description("Sunday.")> _
Sun
<Description("Monday.")> _
Mon
<Description("Tuesday.")> _
Tue
<Description("Wednesday.")> _
Wed
<Description("Thursday.")> _
Thu
<Description("Friday.")> _
Fri
<Description("Saturday.")> _
Sat
End Enum

Private Function GetDescription(ByVal EnumConstant As [Enum]) As String
Dim fi As FieldInfo = EnumConstant.GetType().GetField(EnumConstant.ToString())
Dim aattr() As DescriptionAttribute = _
DirectCast( _
fi.GetCustomAttributes(GetType(DescriptionAttribute), False), _
DescriptionAttribute() _
)
If aattr.Length > 0 Then
Return aattr(0).Description
Else
Return EnumConstant.ToString()
End If
End Function
///

--
Herfried K. Wagner [MVP]
enum contain string Cc
5/24/2004 11:08:35 PM
is there a way to create enum that contain string?

AddThis Social Bookmark Button