If dissimilar metals come in contact with one another, the least noble of the two will sacrifice electrons to the other metal, causing corrosion of the metal. This situation is exacerbated by the presence of moisture and/or salt.
Following is a scale of metals from most noble to least noble: Gold, Platinum, Carbon/Graphite, Titanium, Silver, Chrome, Inconel, Nickel, Monel, Bronze, Copper, Brass, Tin, Lead, Cast Iron, Steel, Iron, Cadmium, Aluminum, Zinc, Magnesium. The closer two metals are on the scale, the better they will perform together. However, electrolysis can occur between any dissimilar metals.
Care should be taken to keep dissimilar metals form coming in contact with one another. In some cases, zinc-coated galvanized steel and aluminum have been used together. While this is not recommended ever, the fact that zinc and aluminum are very close to one another on the nobility scale means that the electrolysis will occur very slowly. Electrolysis will be worst in areas prone to water and salt. Additionally, it is noted that the chemicals used in treated lumber can also shorten the life of metals they come in contact with. Separation between dissimilar materials can be done with building felt or a rubberized material.