Defining Descriptive Text for Enumeration Members

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
An enumeration is a special type in the .NET Framework that is comprised of a number of named constants. While you might not have created an enumeration type yourself, you have likely used enumerations many times in day-to-day programming. For example, the rows in a GridView have a RowType property that returns an enumeration of type DataControlRowType that indicates the rows type: Header, Footer, DataRow, and so on.

When working with an enumeration we may need to display a descriptive message based on the enumerations value. For example, using ASP.NETsMembership system you can programmatically create a new user account calling the Membershipclasss CreateUser method. This method specifies the success or failure of theoperation via the MembershipCreateStatus enumeration.This enumeration has members like Success, InvalidUserName, InvalidPassword, DuplicateUserName, and the like. Whencalling this method from an ASP.NET page you might want to show the user a descriptive message based on this enumeration value.

This article explores three different ways to provide descriptive text for enumeration members. Read on to learn more!
Read More >



More...
 
Back
Top