Using Enums As Return Values From Methods

A common usage of enumerations is representing different results from methods that return a numeric value, as it often happens for Windows API functions or for methods that return a number for communicating the result of the code. For example, consider the following code which defines an enumeration that a method uses in order to communicate the result of a simple elaboration on a file:

image

Actually each Return statement returns an Integer value from 0 to 2 depending on the method result, but using an enumeration provides a more convenient way for understanding the result, as demonstrated in the following ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.