Results 1 to 10 of 10

Thread: enumerators

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    enumerators

    Hi. I am new to enumerations.

    I basically want to create specific enumerators and associate them with a string error message.

    how do I do this?

    I have:

    Code:
    public enum ErrorCode : int
    {
       EnumName1 = -1;
       EnumName2 = -2;
    }
    then...


    Code:
    public class ErrorDescriptors
    {
       const string EnumName1 = "error 1";
       const string EnumName2 = "error 2";
    }
    
    public string DoGetErrorMessage(ErrorCode errorNumber)
    {
       //now I want to take the parameters and associate it with an error message matching the ErrorCode with the ErrorDescriptor class. how?
    }

    As well as this, is it possible to say give the method an INT and then the method would figure out what that value is equal to in the enumerators?
    Last edited by Techno; Apr 27th, 2006 at 05:52 PM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width