Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-09-22
3
Medium Priority
?
805 Views
Last Modified: 2012-05-10
I like this enum but have a few more values I'd like to add.  Is this possible?
0
Comment
Question by:newbieweb
3 Comments
 
LVL 17

Accepted Solution

by:
Jesse Houwing earned 1000 total points
ID: 33742066
Nope.
0
 
LVL 12

Assisted Solution

by:ShazbotOK
ShazbotOK earned 1000 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
        {
            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
 

Author Closing Comment

by:newbieweb
ID: 33766183
Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

824 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