我正在将代码从 java 转换为 c# 并被 int 和 uint 困住。Java 代码(摘录):
public static final int SCALE_PROTO4_TBL = 15;
public static final int [] sbc_proto_4 = { 0xec1f5e60 >> SCALE_PROTO4_TBL };
转换后的 c# 代码(摘录):
public const int SCALE_PROTO4_TBL = 15;
int[] sbc_proto_4 = new int[] { 0xec1f5e60 >> SCALE_PROTO4_TBL };
这会导致以下编译错误:错误 CS0266 无法将类型“uint”隐式转换为“int”。存在显式转换(您是否缺少演员表?)
有很多类似上面的代码,但我不确定是否应该将所有 Java int 转换为 C# uint?我记得 C# uint 不会存储负值,如果 java int 是负数,那么我遇到了问题。
关于我应该如何解决这个问题的任何意见?