Convert String To Enum
Join the DZone community and get the full member experience.
Join For Free
enum EngineType {
unknow,
access,
db2,
mysql,
odbc,
oledb,
oracle,
postgre,
sqlserver
}
string cnxTypeString = "mysql";
EngineType cnxTypeEngine = EngineType.unknow;
if (Enum.IsDefined(typeof(EngineType), cnxTypeString)) {
cnxTypeEngine = (EngineType) Enum.Parse(typeof(EngineType), cnxTypeString, true);
}
Strings
Convert (command)
Data Types
Opinions expressed by DZone contributors are their own.
Comments