Enum type def

From: MuZZy (leyandrewemail-news_at_yahoo.com)
Date: 03/11/04


Date: Thu, 11 Mar 2004 18:20:23 GMT

Hello,
I want to define an enum type, which in delphi would look like:

--------------------------------------------------------
Type
    TOperator = ( opPlus, opMinus, opDivide, opMul, opUnaryMinus );

Var
    operator : TOperator;
..

operator := opPlus

--------------------------------------------------------

How do i do that in C#?

If i define:
enum TOperator { opPlus, opMinus, opDivide, opMul, opUnaryMinus };
that's a variable definition, not a class def, right? And i couldn't do:

TOperator op = opPlus; //???

Do i do it this way: Type op = Typeof(TOperator); //?

Thank you,
Andrey



Relevant Pages

  • Re: Whats the big deal with cross-platform?
    ... closer emulation of some C stuff, e.g. for anonymous unions, ... show me how Delphi does *anonymous* unions. ... simply declare parameters expecting such enumerated values as DWORD, ... ULONG, or similar, and not of the special enum type expected. ...
    (borland.public.delphi.non-technical)
  • Re: Kudos to the team!
    ... With all the press on Delphi 2005, we skipped installing ... Installed Delphi 2006 and was amazed that every major complaint ... I already miss the case (enum type) not ...
    (borland.public.delphi.non-technical)