How do I convert uint to int in C#?

前端 未结 8 1485
时光说笑
时光说笑 2020-12-05 03:54

How do I convert uint to int in C#?

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 04:31

    int intNumber = (int)uintNumber;
    

    Depending on what kind of values you are expecting, you may want to check how big uintNumber is before doing the conversion. An int has a max value of about .5 of a uint.

提交回复
热议问题