【问题标题】:What is the C# equivalent of the MAKEWORD c++ Windows Macro?MAKEWORD c++ Windows 宏的 C# 等效项是什么?
【发布时间】:2013-04-10 12:34:46
【问题描述】:

我需要将一些 c++ 遗留代码转换为 C#,我想知道 MAKEWORD c++ Windows 宏的 C# 等效项是什么?

【问题讨论】:

    标签: c# c++ visual-c++


    【解决方案1】:
    public static uint MakeWord(byte low, byte high)
    {
        return ((uint)high << 8) | low;
    }
    

    但是,您可能需要 int 形式的结果,具体取决于您正在使用它做什么(必要时强制转换)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-27
      • 2023-03-14
      • 2019-09-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-04
      相关资源
      最近更新 更多