博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c# 字节往前移6个字节_C#中字节与字节之间的差异
阅读量:2537 次
发布时间:2019-05-11

本文共 2577 字,大约阅读时间需要 8 分钟。

c# 字节往前移6个字节

C#字节和C#字节 (C# byte and C# sbyte)

A single byte can store 8-bits value. Both are used for byte type of data i.e. the data that contains an only 1-byte value.

一个字节可以存储8位值。 两者均用于字节类型的数据,即仅包含1字节值的数据。

byte is used to work with unsigned byte data, it works with an only positive value between in the range of 0 to 255.

byte用于处理无符号字节数据 ,它的唯一正值在0到255之间

sbyte is used to work with the signed byte data, it works with both types of data (Negative and Positive), it can store the between in the range of -128 to 127.

sbyte用于处理带符号的字节数据 ,它适用于两种类型的数据(负数据和正数据),它可以存储介于-128到127之间的数据

“字节”和“字节”之间的区别 (Differences between 'byte' and 'sbyte')

byte sbyte
byte stands for unsigned byte. sbyte stands for signed byte.
It can store positive bytes only. It can store negative and positive bytes.
It takes 8-bits space in the memory. It also takes the 8-bits in the memory.
Its data range is 0 to 255 that means it can store a minimum value 0 and maximum upto 255. Its data range is -128 to 127 that means it can store a minimum value -128 and maximum upto 127.
Declaration syntax:
byte variable;
Declaration syntax:
sbyte variable;
字节 兆字节
byte代表无符号字节。 sbyte代表有符号字节。
它只能存储正字节。 它可以存储负字节和正字节。
它在内存中占用8位空间。 它还占用存储器中的8位。
它的数据范围是0到255,这意味着它可以存储最小值0和最大值,最多255。 它的数据范围是-128到127,这意味着它可以存储最小值-128和最大值,最多127。
声明语法:
字节变量;
声明语法:
sbyte变量;

Example:

例:

Declaring signed and unsigned byte variable, assigning them with the values and printing the values.

声明有符号和无符号字节变量,为它们分配值并打印值。

using System;using System.Text;namespace ConsoleApplication3{
class Program {
static void Main(string[] args) {
byte a; sbyte b; //printing minimum & maximum values Console.WriteLine("Minimum value of byte: " + byte.MinValue); Console.WriteLine("Maximum value of byte: " + byte.MaxValue); Console.WriteLine("Minimum value of sbyte: " + sbyte.MinValue); Console.WriteLine("Maximum value of sbyte: " + sbyte.MaxValue); a = 0; Console.WriteLine("a = " + a); a = 255; Console.WriteLine("a = " + a); b = -100; Console.WriteLine("b = " + b); b = 123; Console.WriteLine("b = " + b); b = 127; Console.WriteLine("b = " + b); //hit ENTER to exit Console.ReadLine(); } }}

Output

输出量

Minimum value of byte: 0Maximum value of byte: 255Minimum value of sbyte: -128Maximum value of sbyte: 127a = 0a = 255b = -100b = 123b = 127

Read more:

阅读更多:

翻译自:

c# 字节往前移6个字节

转载地址:http://iwozd.baihongyu.com/

你可能感兴趣的文章
shell——按指定列排序
查看>>
crash 收集
查看>>
507 LOJ 「LibreOJ NOI Round #1」接竹竿
查看>>
UI基础--烟花动画
查看>>
2018. 2.4 Java中集合嵌套集合的练习
查看>>
精通ASP.NET Web程序测试
查看>>
vue 根据不同属性 设置背景
查看>>
51Nod1601 完全图的最小生成树计数 Trie Prufer编码
查看>>
Codeforces 1110D. Jongmah 动态规划
查看>>
android驱动在win10系统上安装的心酸历程
查看>>
优雅的程序员
查看>>
oracle之三 自动任务调度
查看>>
Android dex分包方案
查看>>
ThreadLocal为什么要用WeakReference
查看>>
删除本地文件
查看>>
FOC实现概述
查看>>
base64编码的图片字节流存入html页面中的显示
查看>>
这个大学时代的博客不在维护了,请移步到我的新博客
查看>>
GUI学习之二十一——QSlider、QScroll、QDial学习总结
查看>>
nginx反向代理docker registry报”blob upload unknown"解决办法
查看>>