有没有办法在 C# 中编写二进制文字,比如在十六进制前面加上 0x?0b 不起作用.
Is there a way to write binary literals in C#, like prefixing hexadecimal with 0x? 0b doesn't work.
如果没有,有什么简单的方法可以做到这一点?某种字符串转换?
If not, what is an easy way to do it? Some kind of string conversion?
C# 7.0支持二进制文字(以及可选的下划线数字分隔符).
C# 7.0 supports binary literals (and optional digit separators via underscore characters).
一个例子:
int myValue = 0b0010_0110_0000_0011;
您还可以在 Roslyn GitHub 页面上找到更多信息.
You can also find more information on the Roslyn GitHub page.
这篇关于C# 二进制字面量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
车牌检测有哪些好的算法?What are good algorithms for vehicle license plate detection?(车牌检测有哪些好的算法?)
Unity中图像的onClick事件onClick event for Image in Unity(Unity中图像的onClick事件)
运行总 C#Running Total C#(运行总 C#)
单击带有 JAvascript.ASP.NET C# 的超链接时删除目录Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(单击带有 JAvascript.ASP.NET C# 的超链接时删除目录)
asp.net listview 在单击时突出显示行asp.net listview highlight row on click(asp.net listview 在单击时突出显示行)
从函数调用按钮 OnClickCalling A Button OnClick from a function(从函数调用按钮 OnClick)