The issue with a charged particle gun is maintaining coherence over long distances - same-charge particles repulse each other. You'll also have to deal with the fact that if you're shooting, say, positively-charged particles, you're building up just as powerful a negative charge in your own ship, which will need to be resolved (as with ion drives, by the bye, which include a neutralizer to fire off electrons and counteract the loss of protons). These two problems can partially resolve each other by firing two beams in a helical structure - the net charge leaving your ship is neutral (no charge build-up) and the electromagnetic attraction between the two beams, along with the initial velocity imparted by the spiral, keeps the two beams from losing coherence for a while, but that introduces problems of its own, and still is unlikely to give you ranges on the level of other available weaponry.
If combat is being dealt with at significant distances greater than LEO (that is, your sci-fi 'verse has effectively settled the Earth-Moon system or beyond), you'll also get to deal with interactions with ambient magnetic fields - solar wind, fluctuations in planetary magnetic fields if you're fighting near a planet...basically, "windage." These won't affect weapons that are lighter but uncharged (lasers) or heavier (missiles, kinetics), but they will affect particle beams with a significant electric charge (that is, not firing neutrons).
Finally, I don't believe it's likely to be practical to use such a weapon to break electronics specifically, I don't think - anything shielded enough to operate in an environment that includes stuff like solar flares or other similar radiation spikes is likely going to be shielded enough to handle particle beams. Something powerful enough to kill electronics should be powerful enough to kill crew, actually. Your charged particle beam impacting a metal ship is going to become an x-ray generator par excellence through the notion of
bremsstrahlung. That said, anyone worth their salt is going to include some sort of non-metallic ablative - high-density ceramic, say - to block precisely this effect from turning their ship into the Fleet's newest CT scanner.
That's all just me hypothesizing out of my rear, though.