Enum to List

Enum to List

An enum type internally contains an enumerator list. Whenever there is a situation that you have a number of constants that are logically related to each other, then it is the best way that you can group together these constants in an enumeration.


C# Syntax:




VB.Net Syntax:



C# Enum to List

In most cases it is best to define an enum directly within a namespace so that all classes in the namespace can access it with equal convenience. In some situation we want to convert these enum values to List for programming convinence. The following program shows how to convert an enum to List in C# as well as VB.Net


C# Enum to List



VB.Net Enum to List

VB.Net Enum to List



Enum Basics

Enums are strongly typed constants which makes the code more readable and less prone to errors. It is useful when you have a set of values that are functionally significant and unchanged. More about.... Enum in C#

Enum Flags Attribute

The idea of Enum Flags is to take an enumeration variable and allow it hold multiple values. It should be used whenever the enum represents a collection of flags, rather than representing a single value. More about.... Enum Flags Explained



NEXT.....MemoryStream to file