How to convert int array to int?

前端 未结 12 1951
小蘑菇
小蘑菇 2021-01-18 07:49

What I would like to learn how to do is to convert an int array to an int in C#.

However I want to append the int with the values from the array.

Example:

12条回答
  •  爱一瞬间的悲伤
    2021-01-18 08:43

    And just for fun...

    arr.Select((item, index) => new { Item = item, Power = arr.Length - (index - 1) }).ToList().ForEach(item => total += (int)(Math.Pow(10, item.Power) * item.Item));
    

提交回复
热议问题