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

Posted on 2010-09-22
Last Modified: 2012-05-10
I like this enum but have a few more values I'd like to add.  Is this possible?
Question by:newbieweb
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 17

Accepted Solution

Jesse Houwing earned 250 total points
ID: 33742066
LVL 12

Assisted Solution

ShazbotOK earned 250 total points
ID: 33744183
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

        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);
                throw new InvalidCastException("Input value is not a valid type");

Open in new window


Author Closing Comment

ID: 33766183

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Web Add-in Where is Visual Basic used 9 86
Removing Version of .NET in Windows 10 17 140
Difference between Highcharts and Mapbox 10 46
Javascript function 3 24
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question