Search code examples
c#asp.net-mvcenumsmembership-provider

Extending .NET MembershipCreateStatus enum


Basically, what I'm trying to do is add more items to the basic MembershipCreateStatus enum packaged with .NET. However, apparantly you can't do a "partial enum," like so:

public partial enum CreateMembershipStatus
{
    DuplicateCompany = 12,
    ActivityTooRecent = 13,
    MultipleMatches = 14
}

Is there a way for me add items to the CreateMembershipStatus list? My goal is to deal with other predictable outcomes instead of just giving the user the catch all "User Rejected"

Thanks!


Solution

  • You cannot extend an enumeration because they are static and no adding the partial keyword won't work because it is not a class. You will need to create a custom container that contains all the membership statuses you want and then use that instead of the "CreateMembershipStatus" enum.