Certainly no city is recession-proof, but Detroit _was_ almost totally invested in a single economic industry: car manufacturing.
Silicon Valley's emphasis - digital computing devices and software - fuels multiple economic sectors. It seems far more diversified than the auto industry.