A resin composition of the present invention contains: an epoxy resin (A) a hardener (B) and an ion exchanger (C). At least one of the epoxy resin (A) and the hardener (B) contains a modified silicone (S), and the epoxy resin (A) is at least one type selected from the group consisting of a bisphenol A type epoxy resin, a bisphenol F type epoxy resin, a phenol novolac type epoxy resin, and an epoxy-modified silicone.