Question

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!

Was it helpful?

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.

OTHER TIPS

To me seems like custom error handling that you can perform prior to making a call to CreateUser(). Or even better if you do it after CreateUser() call if it fails. In that case you can check the returned MembershipCreateStatus value and perform additional checks as per the status and return a custom message.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top