Solved

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

Posted on 2010-09-22
3
798 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
[X]
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
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

[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 (https://www.experts-exchange.com/questions/29008360/) 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