Using a conversation analysis approach to codeswitching (CS; Auer, 1984, 1998), this study examines the relationship between participants’ orientations to two in-class interactions and their CS practices in a Chinese as a foreign language classroom. Specifically, the analysis focuses on a teacher and one focal student's converging and diverging orientations towards two different types of classroom interaction: assessment talk and an instructed language learning activity. When a mismatch in their orientations occurs, the teacher and student deploy CS as an interactional resource to achieve a common pedagogical goal. CS is thus shown to be a constitutive interactional practice through which the teacher and student accomplish foreign language teaching and learning. Moreover, the close observation of teacher–student interaction in this study encourages language teaching professionals and classroom researchers to consider how CS indexes students' understanding of the pedagogical focus in different classroom activities and how its strategic deployment might foster language learning.