He is not the same character, but he is a close relative: both are solitary, nameless men of St. Petersburg who live on fantasy, and Notes from Underground, of 1864, shows the same figure in a harsher tone, sixteen years after White Nights, of 1848.
The Dreamer of White Nights is twenty-six, has lived for eight years in St. Petersburg without making a single acquaintance, and lives on daydreams. The underground man, at twenty-four, dreams for three months on end, shut away in his corner, of being a hero, and then feels the need to see people. In both, real life arrives through a young woman.
What changes is the outcome. The Dreamer helps Nastenka call back the man she is waiting for and loses everything when he appears. The underground man, who offers to save Liza, pays her back with cruelty when she answers with tenderness. The two share one more trait: at some point they speak in the manner of a book, as if they were reading. Liza says this to the narrator: "You sound... as if you were speaking from a book."
The Second Part of Notes recalls White Nights in another tone: the solitary dreamer who rehearses life in fantasy reappears without innocence. One book does not depend on the other, but read together they show the same kind of man at two different ages.