C#Convert.ToInt32(byte)方法 (C# Convert.ToInt32(byte) Method)

Convert.ToInt32(byte) Method is used to convert a specific byte value to its equivalent integer (int 32 signed number).

Convert.ToInt32(byte)方法用于将特定的字节值转换为其等效的整数(int 32带符号的数字)。

Syntax:

句法:

    int Convert.ToInt32(byte value);

It accepts a byte value/variable as an argument and returns its equivalent signed integer.

它接受字节值/变量作为参数,并返回其等效的带符号整数。

Example:

例:

    Input:
byte a = 100;
Output:
100

Code:

码:

using System;
using System.Text;
namespace Test
{class Program
{static void Main(string[] args)
{byte a = 100;
byte b = 127;
//printing type of a & b
Console.WriteLine("Value of a: {0}, type of a: {1} ", a, a.GetType());
Console.WriteLine("Value of b: {0}, type of b: {1} ", b, b.GetType());
//converting to Int32 and printing its value & type
Console.WriteLine("Value: {0}, type: {1} ", Convert.ToInt32(a), Convert.ToInt32(a).GetType());
Console.WriteLine("Value: {0}, type: {1} ", Convert.ToInt32(b), Convert.ToInt32(b).GetType());
//hit ENTER to exit
Console.ReadLine();
}
}
}

Output

输出量

Value of a: 100, type of a: System.Byte
Value of b: 127, type of b: System.Byte
Value: 100, type: System.Int32
Value: 127, type: System.Int32

翻译自: https://www.includehelp.com/dot-net/Convert-ToInt32-byte-method-in-c-sharp.aspx

C#Convert.ToInt32(byte)方法-将字节值转换为int相关推荐

  1. C#Convert.ToInt32(bool)方法-将bool值转换为int

    C#Convert.ToInt32(bool)方法 (C# Convert.ToInt32(bool) Method) Convert.ToInt32(bool) Method is used to ...

  2. C#Convert.ToInt32(char)方法-将char值转换为int

    C#Convert.ToInt32(char)方法 (C# Convert.ToInt32(char) Method) Convert.ToInt32(char) Method is used to ...

  3. C#Convert.ToInt32(long)方法-将long值转换为int

    C#Convert.ToInt32(long)方法 (C# Convert.ToInt32(long) Method) Convert.ToInt32(long) Method is used to ...

  4. C#Convert.ToInt32(object)方法-将对象值转换为int

    C#Convert.ToInt32(object)方法 (C# Convert.ToInt32(object) Method) Convert.ToInt32(object) Method is us ...

  5. Java面试题:IO流中read()方法为什么返回值是int

    Question:IO流中read()方法为什么返回值是int? anwser:因为字节输入流可以操作任意类型的文件,比如图片音频等,这些文件底层都是以二进制形式的存储的,如果每次读取都返回byte, ...

  6. iBaits中,关于insert返回值的问题(注意!!!不必写resultClass= java.lang.Integer,方法的返回值就是int)

    今天工作中使用iBaits写SQL,其中一个是insert语句 在sqlMap中我这么写了,<insert parameterClass="...." resultClass ...

  7. 两字节16进制值转换为int

    有时候在报文中会碰到以两个字节来存出一个整型的数据,例如0x0080,将其重新转换成int的方法是: char a = 0x80;//低位 char b = 0x00;//高位int value = ...

  8. 在 C# 中,(int) ,Int32.Parse() 和 Convert.toInt32() 三种方法的区别

    在 C# 中,(int),Int32.Parse() 和 Convert.toInt32() 三种方法有何区别? int 关键字表示一种整型,是32位的,它的 .NET Framework 类型为 S ...

  9. (int),Int32.Parse() 和 Convert.toInt32() 的区别

    在 C# 中,(int),Int32.Parse() 和 Convert.toInt32() 三种方法有何区别? int 关键字表示一种整型,是32位的,它的 .NET Framework 类型为 S ...

最新文章

  1. 聚类算法之DBScan(Java实现)[转]
  2. 【BZOJ】【4145】【AMPPZ2014】The Prices
  3. layui数据表格循环数据给特殊行变颜色遇到的bug
  4. 使用numpy实现神经网络模块
  5. omv检查硬盘坏道_坏道检测与修复
  6. matlab padarray函数零,matlab padarray函数
  7. solr4 mysql自动更新_solr7.4 定时增量更新数据-Go语言中文社区
  8. 「02」《机器学习经·天工开物篇》
  9. UE4官方文档UI学习:1.UMG UI设计器快速入门
  10. MC34063在扩展后的降压应用
  11. winEdt下编辑报错:Something‘s wrong--perhaps a missing \item. \end{thebibliography}
  12. 计算机基础晦涩难懂?那你是没看他的图解文章!
  13. 男人就应该对自己狠一点
  14. Mac系统好用快捷键简记
  15. 反转链表详细讲解(就地逆置法)
  16. [游戏记录]滚动的天空
  17. Bitwig Studio 4.0.1 x64 Windows+Linux 音乐制作宿主软件
  18. 规则引擎在数据治理平台的实践
  19. GroupM小结1(14年8月28日)
  20. 想要成为一个游戏美术设计师,需要学习什么?游戏建模教程

热门文章

  1. redhat enterprise linux 哪个版本好,Red Hat Enterprise Linux 版本显示中(Santiago)是啥意思?...
  2. C++ ACM模式输入输出
  3. ugui源码_UGUI整体解决方案基础篇(Unity 2019)
  4. linux添加删除回环地址,CentOS7如何添加本地回环地址?CentOS7添加本地回环地址的方法...
  5. MySQL优化调优有没有做过_MySQL 调优/优化的 100 个建议
  6. java main是标识符吗_main方法的认识 、通配符、java的注释、java的符(标识符)【Java基础】...
  7. oftc注册服务器占用,golang服务器程序运行过程中崩溃,报错:fatal error: runtime: out of memory...
  8. c语言提取七位数讲解,C语言-体育彩票7位数,感受身中500万的fell
  9. logstash安装
  10. 获取Linux内存、cpu、磁盘IO等信息