In a saucepan, heat the milk over medium heat until it starts to simmer.
In a mixing bowl, whisk together the sugar and cornstarch.
Gradually add the hot milk to the sugar mixture, whisking constantly to avoid lumps.
Return the mixture to the saucepan and cook over medium heat, stirring constantly, until it thickens.
Remove from heat and stir in the vanilla extract.
In a separate bowl, beat the egg yolks. Slowly add a small amount of the hot mixture to the yolks, whisking constantly.
Pour the egg yolk mixture back into the saucepan and cook for another 2-3 minutes, stirring constantly.
Pour the custard into serving dishes and let it cool before serving.