Main Content

Default Methods for an Enumeration

By default, MATLAB® provides the following methods for a .NET enumeration:

  • Relational operators — eq, ne, ge, gt, le, and lt.

  • Conversion methods — char, double, and a method to get the underlying value.

  • Bitwise methods — Only for enumerations with the System.Flags attribute.

For example, type:

Methods for class System.DayOfWeek:

CompareTo    eq
DayOfWeek    ge
Equals       gt
GetHashCode  int32
GetType      le
GetTypeCode  lt
ToString     ne

The method to get the underlying value is int32.

The NetDocEnum.MyDays enumeration, which has the Flags attribute, has the bitwise methods. To list the methods, type:

Methods for class NetDocEnum.MyDays:

CompareTo    char         
Equals       double       
GetHashCode  eq           
GetType      ge           
GetTypeCode  gt           
MyDays       int32        
ToString     le           
bitand       lt           
bitnot       ne           

Related Examples

More About