public override void ExplicitVisit(BinaryLiteral node) { if (node.Value.StartsWith("0x") && node.Value.Length <= 10) { var value = Convert.ToUInt32(node.Value, 16); //Using ToUInt32 not ToUInt64, as per OP comment lastExpression = new cs.CodePrimitiveExpression(value); } else { throw new NotImplementedException(node.AsText()); } }