Five kinds of nanowires and a nanochain that is embedded in a carbon nanotube have been optimized by density function theory, and the electronic transport properties through these nanowires and nanochain are studied. Our results indicate that the transmission spectra exhibit size-dependent oscillations. We observe and study the nonlinear contribution to the I-V characteristic (current-voltage) curves that is due to the quantum size effect. The I-V curve of the single chain is different from that when the chain is embedded in a carbon nanotube. The results provide valuable information on the correlation between the transport properties of nanowires and their microstructures.