单引号字符串到uint在c#

参见英文答案 > What do single quotes do in C++ when used on multiple characters?4个
> Single quotes vs. double quotes in C or C++12个
我正在翻译一些C到C#代码,我看到下面的定义:
#define x 'liaM'

首先,这个单引号是什么意思?我在c#中使其成为字符串常量吗?

其次,这个常数被赋值为C中的uint变量.这是如何工作的?

uint m = x;
这有时被称为 FOURCC.有一个Windows API可以将字符串转换为称为 mmioStringToFOURCC的FOURCC,这里有一些C#代码来做同样的事情:
public static int ChunkIdentifierToInt32(string s)
{
    if (s.Length != 4) throw new ArgumentException("Must be a four character string");
    var bytes = Encoding.UTF8.GetBytes(s);
    if (bytes.Length != 4) throw new ArgumentException("Must encode to exactly four bytes");
    return BitConverter.ToInt32(bytes,0);
}

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...