In linguistics, code-switching "refers to instances when speakers switch between codes (languages, or language varieties) in the course of a conversation. Switches may involve different amounts of speech and different linguistic units - from several consecutive utterances to individual words and morphemes."
Colloquially, code-switching means being able to switch between dialects (and cultural expression, behaviors, and mannerisms) based on one's surroundings. In terms of privilege, it means, for one, employing the prestige dialect of the society when necessary, for example, in professional and academic settings. In the United States, Standard American English is the privileged language.
Because "code-switching" is a linguistic term, many of the books on the topic are highly technical and come from a language-study approach (grammar, syntax, etc). However, there are books that also discuss educational implications and give social context to various kinds of code-switching, for example, from African American Vernacular English (AAVE) to Standard American English (AAE) in classrooms.