Solved

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

Posted on 2010-09-22
3
794 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:
ToAoM earned 250 total points
ID: 33742066
Nope.
0
 
LVL 12

Assisted Solution

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now