Whisk together the sugar , corn flour and salt in a medium saucepan (thick bottomed). This breaks up the corn flour and prevents it from clumping .
In a glass or bowl , whisk together the egg yolks and the milk until smooth.
Pour the egg yolk- milk mixture into the sugar- corn flour mixture in the saucepan while whisking continuously
Add the butter and heat on medium flame. Whisk continuously.
First the butter will melt and the mixture will come to a boil.
Lower the flame and cook for a couple of minutes more while stirring as the custard thickens.Add any flavouring that you wish now. I added 1 tsp vanilla extract here
Pass through a sieve into a clean bowl. This is optional but removes any bit of cooked egg .
Cover the pastry cream with cling wrap , such that the wrap is touching the surface of the cream . This prevents a film from forming. Chill for atleast two hours .
Notes
Pastry cream be refrigerated from 5 to 7 days . For a lighter cream , whip 1/4 or 1/2 cup heavy cream to soft peaks and fold into the cream.