Link to home
Start Free TrialLog in
Avatar of vivekj2004
vivekj2004

asked on

C# enum

I want to use enums like this here, but cannot. Can somebody tell me what to do?

 CrcliEligibilityResponseDTO cliresp = new CrcliEligibilityResponseDTO();
if (a=1)
cliresp.CLIAppDecPen = cliresp.CLIAppDecPen.A;
if (a=2)
cliresp.CLIAppDecPen = cliresp.CLIAppDecPen.D;
if (a=3)
cliresp.CLIAppDecPen = cliresp.CLIAppDecPen.P;
Avatar of wdosanjos
wdosanjos
Flag of United States of America image

What's CrcliEligibilityResponseDTO.CLIAppDecPen's type?
You can't use this same name for property and inner type. Change name od property or enum.
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're almost there, this should work (assumping the enum name is CLIAppDecPen):


CrcliEligibilityResponseDTO cliresp = new CrcliEligibilityResponseDTO();
if (a=1)
cliresp.CLIAppDecPen = CLIAppDecPen.A;
if (a=2)
cliresp.CLIAppDecPen = CLIAppDecPen.D;
if (a=3)
cliresp.CLIAppDecPen = CLIAppDecPen.P;

Open in new window

Avatar of vivekj2004
vivekj2004

ASKER

I was forced to select a solution, that's why I selected this. Otherwose I don't want to give points to any solution. None of the solution was complete.