Apache License 2.0
A small .NET library providing a handful of useful Enum functions which are missing from the .NET Compact Framework (CF.NET).
Enum
names as String
arrayEnum
values as Object
arrayEnum
value via its String
name Take as an example the following VB.NET Enum
:
Enum Season
Spring
Summer
Fall
Winter
End Enum
Get Enum
names as String
array:
Dim seasonNames = EnumUtils.GetNames(GetType(Season))
Assert.AreEqual("Fall", seasonNames(2))
Get Enum
values as Object
array:
Dim seasonValues = EnumUtils.GetValues(GetType(Season))
Assert.AreEqual(2, seasonValues(2))
Get Enum
value via its String
name:
Dim fallValue = EnumUtils.GetValueForName(GetType(Season), "Fall")
Assert.AreEqual(2, fallValue)
This library and associated unit tests were developed in VS 2008 as Smart Device projects.
Author: Marc Siegel <msiegel -at- kdsecure.com>
Copyright: (c) 2010 by KD Secure, LLC
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.