You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The piece of code bellow generates the error "Cannot retrieve heap variable of type 'Int32' as type 'DataToken'"
DataDictionary _dict;
// more code here that initializes the dictionary
void SomeFunction(EEnum enumVal)
{
DataToken key = (int) enumVal;
if (!_dict.ContainsKey(key)) //crash here
{
}
}
To fix it, I need to use Convert.ToInt32() instead of using a regular (int) cast, like this :
DataToken key = Convert.ToInt32(enumVal);
if (!_dict.ContainsKey(key))
The text was updated successfully, but these errors were encountered:
The piece of code bellow generates the error "Cannot retrieve heap variable of type 'Int32' as type 'DataToken'"
To fix it, I need to use
Convert.ToInt32()
instead of using a regular (int) cast, like this :The text was updated successfully, but these errors were encountered: