Set enum using hashcode

This is a simple question which I though would already exist but haven’t been able to find the answer to even on MSDN so please just point me in the right direction if I appear to be blind.

So my question is how do you set an enum using a hash code?

I know how to use .GetHashCode() but i cant seem to be able to use it to set an enum instance of the same type. I thought it would look something like this:

myEnum = MyEnum[hashCode];
//or with round brackets

If you’re wondering why I need to use a hash Code it’s because I’m sending the data in a RPC networking call were I can only use a set amount of data types i.e. no enums.

Thanks in advance,

Minchuilla

Use a string or an int.