Hi, can anyone help me on this snippet.
I want to improve the casting to be dependent on the variable it will be assigned to, is there a way? (Please see source code below)
I tried the "typeof" but it is not the right thing to use.
Hope anyone can help me on this.
Thanks a lot in advance.
I want to improve the casting to be dependent on the variable it will be assigned to, is there a way? (Please see source code below)
I tried the "typeof" but it is not the right thing to use.
Hope anyone can help me on this.
Thanks a lot in advance.
Code:
switch (nodeName.Name)
{
//header elements
case ConstantVariables.ELEM_MSGID:
_messageID = Convert.ToUInt32(nodeName.InnerText);
break;
case ConstantVariables.ELEM_GPBAL:
GameState.PlayerState.Player.CurrentBalance = Convert.ToInt64(nodeName.InnerText);
break;
default:
nodeName.ParentNode.RemoveChild(nodeName);
break;
}
Comment