J
Jim Heavey
Trying to figure out how to convert back an forth between and Enum.
I am working with DbType. I am want to create a string value of what a
particular DbType is, say "DbType.String" to "String" and then convert
"string" back to "DbType.String"
I understand that I can get the string value as follows:
string myEnumString = DbType.String.ToString();
I also understand that I get turn it back into the "Enum" as follows:
DbType myEnumType = DbType.Parse(GetType(DbType), myEnumString)
This method does not compile - It highlights "DbType" and tells me it
expects a variable and not a class.
Any Idea what I am doing wrong?
I am working with DbType. I am want to create a string value of what a
particular DbType is, say "DbType.String" to "String" and then convert
"string" back to "DbType.String"
I understand that I can get the string value as follows:
string myEnumString = DbType.String.ToString();
I also understand that I get turn it back into the "Enum" as follows:
DbType myEnumType = DbType.Parse(GetType(DbType), myEnumString)
This method does not compile - It highlights "DbType" and tells me it
expects a variable and not a class.
Any Idea what I am doing wrong?