C# - How to convert 10 bytes to unsigned long
<p>I have 10 bytes - 4 bytes of low order, 4 bytes of high order, 2 bytes of highest order - that I need to convert to an unsigned long. I've tried a couple different methods but neither of them worked:</p>

<p>Try #1:</p>

<pre><code>var id = BitConverter.ToUInt64(buffer, 0);
</code></pre>

<p>Try #2:</p>

<pre><code>var id = GetID(buffer, 0);

long GetID(byte[] buffer, int startIndex)
        {
            var lowOrderUnitId = BitConverter.ToUInt32(buffer, startIndex);
            var highOrderUnitId = BitConverter.ToUInt32(buffer, startIndex + 4);
            var highestOrderUnitId = BitConverter.ToUInt16(buffer, startIndex + 8);
            return lowOrderUnitId + (highOrderUnitId * 100000000) + (highestOrderUnitId * 10000000000000000);
        }
</code></pre>

<p>Any help would be appreciated, thanks!</p>
