If you have two materials that are different that are being joined together what is used to keep them from being corrosive?

If you have two materials that are different that are being joined together what is used to keep them from being corrosive?