How do I extend System.Web.Security.MembershipCreateStatus?

I like this enum but have a few more values I'd like to add.  Is this possible?
newbiewebSr. Software EngineerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Jesse HouwingConnect With a Mentor Scrum Trainer | Microsoft MVP | ALM Ranger | ConsultantCommented:
Nope.
0
 
ShazbotOKConnect With a Mentor Commented:
You cannot extend enums however you could use a struct to interpret the integer value and return the appropriate enum as an object based off of the matched value.
public struct MembershipCreateStatusExtensions
    {
        public enum ExtendedMemberShipCreateStatus
        {
            CreatePending,
            CreateProcessing,
            CreateProcessed
        }

        public object GetEnumValue(int input)
        {
            if (Enum.IsDefined(typeof(MembershipCreateStatus), input))
                return Enum.ToObject(typeof(MembershipCreateStatus), input);
            else if (Enum.IsDefined(typeof(ExtendedMemberShipCreateStatus), input))
                return Enum.ToObject(typeof(ExtendedMemberShipCreateStatus), input);
            else
                throw new InvalidCastException("Input value is not a valid type");
        }
    }

Open in new window

0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.