ReSharper 2024.1 Help

Code inspection: Use unsigned right shift operator '>>>'

This inspection recognizes a cumbersome code pattern that C# developers had to write to perform the unsigned right shift for signed types. It suggests replacing such patterns with the unsigned right shift operator >>>, introduced in 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 }
Last modified: 08 May 2024