Alex Rivera | Logout

Get the Integer value of an enumeration which is a generic

Asked 2008-12-18T18:48:57.083
33

Here is the basic situation.

Public Class MyEnumClass(of T)
   Public MyValue as T
End Class

This is vast oversimplification of the actual class, but basically I know that T is an enumeration (if it is not then there will be many other problems, and is a logical error made by the programmer)

Basically I want to get the underlying integer value of MyValue.

Using Cint or Ctype, does not work.

Edit
Report

1 Answer

8

I tried this and it worked:

String.Format("{0:d}", MyValue)
answered 2008-12-18T18:59:48.387

Your Answer