How to compare Session Variable(which is an enum variable) with enum value.

Posted by Mahe under C# on 9/12/2012 | Points: 10 | Views : 2064 | Status : [Member] | Replies : 1
Hi,

How to compare Session Variable(which is an enum variable) with enum value.
ex: Session[enum.value1] == enum.value

but the above syntax is not working
the value are of type string.

Regards,
Mahe




Responses

Posted by: Gopesh9 on: 9/12/2012 [Member] Starter | Points: 25

Up
0
Down
Hey,

You need to cast the Session object back to enum.

if(((enum)Session[enum.value1]) == enum.value)


Hope this helps...

G. S.
.Net Developer

Mahe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response