How to escape < and > inside <pre> tags

I'm trying to write a blog post which includes a code segment inside a <pre> tag. The code segment includes a generic type and uses <> to define that type. This is what the segment looks like:

<pre>
    PrimeCalc calc = new PrimeCalc();
    Func<int, int> del = calc.GetNextPrime;
</pre>

The resulting HTML removes the <> and ends up like this:

PrimeCalc calc = new PrimeCalc();
Func del = calc.GetNextPrime;

How do I escape the <> so they show up in the HTML?


<pre>
    PrimeCalc calc = new PrimeCalc();
    Func&lt;int, int&gt; del = calc.GetNextPrime;
</pre>

<pre>&gt;</pre>

renders as:

>

So you want:

<pre>
    PrimeCalc calc = new PrimeCalc();
    Func&lt;int, int&gt; del = calc.GetNextPrime;
</pre>

which turns out like:

    PrimeCalc calc = new PrimeCalc();
    Func<int, int> del = calc.GetNextPrime;

Use &lt; and &gt; to do < and > inside html.