Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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.

  • Bit-wise methods — Only for enumerations with the System.Flags attribute.

For example, type:

methods('System.DayOfWeek')
Methods for class System.DayOfWeek:

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

The method to get the underlying value is int32.

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

methods('NetDocEnum.MyDays')
Methods for class NetDocEnum.MyDays:

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

Related Examples

More About

Was this topic helpful?