In the 1880s and 1890s, the dime novel audience shifted to working-class young adults as the U.S. urbanized, and detectives replaced cowboys as heroes.
The underlying structure of the stories was similar to Westerns. Breakdowns in social order were restored by a hero who worked outside the law to protect the community. Immigrants became the villains, reflecting white working-class fears about immigrants taking their jobs.
Dime novel detectives originally did not rely on analytical thinking skills, like Sherlock Holmes. Instead, mysteries were solved after a series of startling revelations. The detective could be a master of disguise, and was often kidnapped, hunted and terrorized, escaping certain death by inches.
Like many Westerns, detective novels often ended with a wedding, symbolizing a return to conventional social standards.