Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Making an IEnumerable Enum - .Net Framework

RSS
Modified on Wed, Oct 29, 2008, 2:05 PM by Administrator Categorized as ┬ĚNet Framework
The following C# code demonstrates how to enumerate through all possible values of an Enum type within a foreach loop. Replace EnumType with your enum type. You can convert code between C# and VB.NET at this website.

EnumType[] values = (EnumType[])Enum.GetValues(typeof(EnumType));

foreach (EnumType value in values)
{
    ...
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.