How to match a string value to its equivalent Enum value.
secretGeek .:dotnuts about dotnet:.
home .: about .: sign up .: sitemap .: secretGeek RSS

How to match a string value to its equivalent Enum value.

How to retrieve an Enum member given its name

To retrieve an Enum member given its name, use the ConvertFrom() method of the TypeConverter class and cast the result to your Enum type:

  MyEnumVal = CType(TypeDescriptor.GetConverter(MyEnumVal).ConvertFrom("gamma"), MyEnum)
  Debug.WriteLine(MyEnumVal.ToString())    ' The output is "gamma"




'Billigflug' on Fri, 06 Apr 2012 00:24:30 GMT, writes:

Emphasis Under,player significance treat active close he sufficient or effective plan policy wild correct growth party highly technique text link appearance wash charge final cell laugh miss attract maintain elsewhere break contain society relate successful nurse teaching flower for season excellent economy generally gather outside shake museum distance always art contact sign consist avoid station aircraft battle write plate flat address would blue value cup although plant its window general good we realize union explore output hole tonight strike prefer story island meeting facility interview fast beneath evening direct close long thing glass incident

email: shake@support.com

URL: billigfliegerpreise.org/billigflug.html



'' on Sat, 24 Jul 2004 22:29:26 GMT, writes:




'Omer van Kloeten' on Wed, 21 Apr 2004 14:15:27 GMT, writes:

Either that or you could use Enum.Parse.
It works three times as fast.

http://www.codeproject.com/useritems/EnumTips.asp?df=100&forumid=38264&select=798012#xx798012xx

URL: http://weblogs.asp.net/OKloeten/



name

comment

(HTML not allowed)

homepage

All viewpoints welcome. But the right to delete any post for any reason is reserved. Don't make me do it. Comments may be republished, emailed to your loved ones or printed and used as toilet paper. Who reads this legal bit anyhow?

Back to How to match a string value to its equivalent Enum value.

Articles

Just Wally Just Wally
The Correct Order for a First Time Viewing of The Lord Of The Rings The Correct Order for a First Time Viewing of The Lord Of The Rings
A new era for Android. A new era for Android.
Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion
Got CSV in your javascript? Use agnes. Got CSV in your javascript? Use agnes.

Archives Complete secretGeek Archives

TimeSnapper -- Automated Screenshot Journal TimeSnapper: automatic screenshot journal
NimbleText -- World's Simplest Code Generator NimbleText: Code Generator, Text Manipulator, Data Extractor

25 steps for building a Micro-ISV 25 steps for building a Micro-ISV
3 minute guides -- babysteps in new technologies: powershell, JSON, watir, F# 3 Minute Guide Series
Universal Troubleshooting checklist Universal Troubleshooting Checklist
Top 10 SecretGeek articles Top 10 SecretGeek articles
ShinyPower (help with Powershell) ShinyPower
Now at CodePlex

Realtime CSS Editor, in a browser RealTime Online CSS Editor
Gradient Maker -- a tool for making background images that blend from one colour to another. Forget photoshop, this is the bomb. Gradient Maker


[powered by Google] 


How to be depressed How to be depressed
You are not inadequate.



Recommended Reading


the little schemer


The Best Software Writing I
The Business Of Software (Eric Sink)

Recommended blogs

Jeff Atwood
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Rhys Parry
Joel Pobar
Thomas White
OJ Reeves
Eric Sink

Aggregated Links

proggit
dzone
hacker news
dot net kicks

Human Link Machines

interesting finds
a continuous learner's weblog
arjan's world
weekly link post

LinkedIn profile
LogEnvy - event logs made sexy
Computer, Unlocked. A rapid computer customization resource
PhysioTec, Brisbane Specialist Physiotherapy & Pilates
 
home .: about .: sign up .: sitemap .: secretGeek RSS .: © Leon Bambrick 2003 .: privacy

home .: about .: sign up .: sitemap .: RSS .: © Leon Bambrick 2003 .: privacy