title: Get Int32 from Span<byte>
body: <p>Been researching spans, memory etc . I'm trying to understand the intended method for getting an int out of a Span</p>
  
  <p>Of all the blog posts I've read there was hinting of a <code>NonPortableCast&lt;T&gt;</code> method being implemented, but it appears that it has been removed.</p>
  
  <p>I also read about it potentially being renamed to <code>.Cast&lt;T&gt;</code> on one of Marc Gravell's posts but again, I cant find it anywhere. </p>
  
  <p>So given:</p>
  
  <pre><code>public ReadOnlySpan&lt;byte&gt; MessageBytes {get;set;}
  public ReadOnlySpan&lt;byte&gt; ItemLengthBytes =&gt; MessageBytes.Slice(0,4);
  </code></pre>
  
  <p>How do I convert those 4 bytes to an int?</p>
  
  <p>Here is what Im doing now, is this the correct way? Or is there a faster way?</p>
  
  <pre><code>public int ItemLength =&gt; Convert.ToInt32(ItemLengthBytes.ToArray());
  </code></pre>