Put the milk, sugar, salt, egg yolks, and cornstarch in a 2-quart saucepan. If you're using a vanilla bean, split it in half lengthwise, scrape the soft, pulpy seeds into the pan, and toss in the pod. If you're using vanilla extract, keep it in reserve until the cream is cooked. Stir with a wire whisk to blend, bring to the boil, whisking constantly, and let the pastry cream boil for 30 to 60 seconds, at which point it will have thickened and the whisk will leave tracks as you stir. Take the pan off the heat and scrape the pastry cream into a strainer set over a bowl.
Push the cream through the strainer into the bowl and discard the vanilla bean, if you used it; if you're using extract, stir it in now. Cover the bowl with plastic wrap, pressing the plastic against the surface of the pastry cream. The cream can be made up to 3 days in advance and kept tightly covered in the refrigerator.