代码检查:使用无符号右移运算符 '>>>'
此检查识别出 C# 开发人员为了对有符号类型执行无符号右移而不得不编写的繁琐代码模式。 它建议将此类模式替换为 无符号右移运算符>>> ,该运算符在 C# 11 中引入。
void ReadData(int headerValue)
{
var shifted = (int)((uint) headerValue >> 1);
// read shifted data
}
void ReadData(int headerValue)
{
var shifted = headerValue >>> 1;
// read shifted data
}
最后修改日期: 2025年 9月 26日