It sounds like you want something like:
uint result = 0;
foreach (var digit in array)
{
result = result * 10 + digit;
}
Or more fancily, using LINQ:
uint result = array.Aggregate((uint) 0, (curr, digit) => curr * 10 + digit);
Question
Let's say I have array of bytes
byte[] byteArr = new byte[] { 1, 2, 3, 4, 5 };
I want to convert this array to get regular numeric variable of uint, so result will be
uint result = 12345;
So far all the example I've seen were with bytes, byte I don't need bytes, but numeric value.
Thanks...
Solution
It sounds like you want something like:
uint result = 0;
foreach (var digit in array)
{
result = result * 10 + digit;
}
Or more fancily, using LINQ:
uint result = array.Aggregate((uint) 0, (curr, digit) => curr * 10 + digit);