Search code examples
c#delphicommandequivalent

What is a equivalent of Delphi "shl" in C#?


I'm making an application in C#, based on Delphi (converting code), but I found a command that I do not recognize (shl), and i want to know if there is any equivalent to C#.

Thanks in advance.


Solution

  • Shl is left shift. Use << C# operator for the same effect.

    Example:

    uint value = 15;              // 00001111
    uint doubled = value << 1;    // Result = 00011110 = 30
    uint shiftFour = value << 4;  // Result = 11110000 = 240