I don't understand why this would be a problem. You would simply
declare both the operator overloads in the class that contains the
"States" enum.

On Nov 27, 10:01 am, thomat65 <[EMAIL PROTECTED]> wrote:
> Hey everyone!
>
> I've run into a slight snag with VB.NET where I need a variable of an
> enumerated type such as:
>
> "
>     Public Enum States
>         x = 0
>         o
>         unmarked
>         unknown
>     End Enum
> "
>
> to be converted into some arbitrary string value other than "x", "o",
> "unmarked", or "unknown", and vise versa possibly with an overloaded
> operator like:
>
> "
>     Public Shared Widening Operator CType(ByVal State As States) As
> String
>         'useful stuff here...
>     End Operator
> "
>
> but I can't just put this overloaded CType function in the enum block
> for obvious reasons, so where would it go? Am I missing something or
> is it simply impossible to overload operators for enumerated types in
> VB?
>
> To give you a further understanding of what I want, in C++ overloading
> operators for situations like this was quite simple and
> straightforward. All you would have to do is say something like
>
> "
>     States operator[operator here](some parameters)
>         {/*code here*/}
> "
>
> and it would do exactly what I needed with no fuss.

Reply via email to