Solved

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

Posted on 2010-09-22
3
797 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 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

830 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