I'm not sure what you are trying to do with that code, but I don't think a typecast is the right course of action.