c#byte字节流的读取
C#字节关键字 (C# byte keyword)
In C#, byte is a keyword which is used to declare a variable that can store an unsigned value between 0 to 255. byte keyword is an alias of System.Byte.
在C#中, byte是一个关键字,用于声明一个变量,该变量可以存储0到255之间的无符号值。byte 关键字是System.Byte的别名。
It occupies 1 byte (8 bits) in the memory.
它在内存中占用1个字节(8位)。
Syntax:
句法:
byte variable_name = value;
It can store value between 0 to 255.
它可以存储0到255之间的值。
C#代码演示byte关键字示例 (C# code to demonstrate example of byte keyword)
Here, we are declaring a byte variable num, initializing it with the value 120 and printing its value, type, and size of a byte type variable.
在这里,我们声明一个字节变量num ,将其初始化为值120并打印其值,类型和字节类型变量的大小。
using System;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
//byte variable declaration
byte num = 120;
//printing value
Console.WriteLine("num: " + num);
//printing type of variable
Console.WriteLine("Type of num: " + num.GetType());
//printing size of a bool
Console.WriteLine("Size of a byte variable: " + sizeof(byte));
//hit ENTER to exit
Console.ReadLine();
}
}
}
Output
输出量
num: 120
Type of num: System.Byte
Size of a byte variable: 1
翻译自: https://www.includehelp.com/dot-net/byte-keyword-in-c-sharp.aspx
c#byte字节流的读取