C#二进制常量重新presentation [英] C# binary constants representation

查看:240
本文介绍了C#二进制常量重新presentation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的难倒在这一个。在C#中有一个十六进制常数重新如下presentation格式为:

I am really stumped on this one. In C# there is a hexadecimal constants representation format as below :

int a = 0xAF2323F5;

有一个二进制常量重新presentation格式?

is there a binary constants representation format?

推荐答案

不,在C#中没有二进制文字。当然,你可以解析使用Convert.ToInt32的二进制格式的字符串,但我不认为这是一个很好的解决方案。

Nope, no binary literals in C#. You can of course parse a string in binary format using Convert.ToInt32, but I don't think that would be a great solution.

int bin = Convert.ToInt32( "1010", 2 );

这篇关于C#二进制常量重新presentation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆