How can I do take a substring and length of a string in C# if that string might be a null?
<p>I have the following strings:</p>

<pre><code>var temp = null;
var temp = "";
var temp = "12345678";
var temp = "1234567890";
</code></pre>

<p>What I need to do is if have a function that will give me the last four digits of the input variable if the input variable is 8 or 10 characters long. Otherwise I need it to return "";</p>

<p>Is there an easy way I can do this in C#. I am just not sure how to deal with null because if I get the length of null then I think that will give me an error.</p>
