Can't convert int to byte
<p>I'm in the process of converting a Delphi app to C#, and I came across this:</p>

<pre><code>alength:=1; //alength is a byte
aa:=astring //astring is a string parameter passed into the function containing all this

alength:=strtoint(copy(aa,2,length(aa)-1));
</code></pre>

<p>So <code>copy</code> creates a string from part of an existing string, with the first character of the string starting at index <code>1</code>, not <code>0</code> like other languages. It uses this format: </p>

<p><code>function copy ( Source : string; StartChar, Count : Integer ) : string;</code></p>

<p>And then <code>strtoint</code> which converts a <code>string</code> to an <code>int</code>.</p>

<p>For my c# conversion of that bit of code, I have:</p>

<p><code>alength = Convert.ToInt32(aa.Substring(1 ,aa.Length - 1));</code></p>

<p>which gives me the error <code>Error 131 Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?)</code></p>

<p>Since <code>alength</code> is already type byte, I didn't think I had to cast it? </p>