日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

c# 整数类型转byte_C#中数据类型的整数类型

發布時間:2023/12/1 C# 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c# 整数类型转byte_C#中数据类型的整数类型 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

c# 整數類型轉byte

Here is the list of the built-in integral types of data types in C#, sbyte, byte, char, short, ushort, int, uint, long and ulong

這是C#, sbyte , byte , char , short , ushort , int , int , uint , long和ulong中數據類型的內置整數類型的列表

C#數據類型的積分類型 (C# Integral types of Data types)

.tbl-temp tr th{background-color: #006969; color: #fff;}.tbl-temp a, a:visited{color: #006969;font-weight: 500;text-decoration: none;}.tbl-temp a:hover{text-decoration: underline;} .tbl-temp tr th{background-color: #006969; color: #fff;}.tbl-temp a, a:visited{color: #006969;font-weight: 500;text-decoration: none;}.tbl-temp a:hover{text-decoration: underline;} TypeSystem typeSize (in bits)Value RangeValue type
sbyteSystem.SByte8-bits-128 to 127Signed integer
byteSystem.Byte8-bits0 to 255Unsigned integer
charSystem.Char16-bitsU+0000 to U+ffffUnicode character
shortSystem.Int1616-bits-32,768 to 32,767Signed integer
ushortSystem.Int1616-bits0 to 65,535Unsigned integer
intSystem.Int3232-bits-2,147,483,648 to 2,147,483,647Signed integer
uintSystem.Int3232-bits0 to 4,294,967,295Unsigned integer
longSystem.Int6464-bits-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807Signed integer
ulongSystem.Int6464-bits0 to 18,446,744,073,709,551,615Unsigned integer
類型 系統類型 大小(以位為單位) 取值范圍 值類型
兆字節 系統字節 8位 -128至127 有符號整數
字節 系統字節 8位 0至255 無符號整數
燒焦 系統字符 16位 U + 0000至U + ffff Unicode字符
System.Int16 16位 -32,768至32,767 有符號整數
超短 System.Int16 16位 0至65,535 無符號整數
整型 System.Int32 32位 -2,147,483,648至2,147,483,647 有符號整數
int System.Int32 32位 0至4,294,967,295 無符號整數
System.Int64 64位 -9,223,372,036,854,775,808至9,223,372,036,854,775,807 有符號整數
烏龍 System.Int64 64位 0至18,446,744,073,709,551,615 無符號整數

Example:

例:

In this example, we are declaring variables of different integral types of data types, initializing with the different value, printing the system types of the variables, size of the types and min, max values of the types.

在此示例中,我們聲明了不同整數類型的數據類型的變量,使用不同的值進行初始化,打印了變量的系統類型,類型的大小以及類型的最小值,最大值。

using System; using System.Text;namespace Test {class Program{static void Main(string[] args){//sbytesbyte a = -10;Console.WriteLine("sbyte...");Console.WriteLine("a = " + a);Console.WriteLine("type of variable = " + a.GetType());Console.WriteLine("size of sbyte = " + sizeof(sbyte));Console.WriteLine("Min value of sbyte = " + sbyte.MinValue);Console.WriteLine("Max value of sbyte = " + sbyte.MaxValue);Console.WriteLine();//bytebyte b = 10;Console.WriteLine("byte...");Console.WriteLine("b = " + b);Console.WriteLine("type of variable = " + b.GetType());Console.WriteLine("size of byte = " + sizeof(byte));Console.WriteLine("Min value of byte = " + byte.MinValue);Console.WriteLine("Max value of byte = " + byte.MaxValue);Console.WriteLine();//charchar c = 'P';Console.WriteLine("char...");Console.WriteLine("c = " + c);Console.WriteLine("type of variable = " + c.GetType());Console.WriteLine("size of char = " + sizeof(char));Console.WriteLine("Min value of char = " + (int)(char.MinValue));Console.WriteLine("Max value of char = " + (int)(char.MaxValue));Console.WriteLine();//shortshort d = -18910;Console.WriteLine("short...");Console.WriteLine("d = " + d);Console.WriteLine("type of variable = " + d.GetType());Console.WriteLine("size of short = " + sizeof(short));Console.WriteLine("Min value of short = " + short.MinValue);Console.WriteLine("Max value of short = " + short.MaxValue);Console.WriteLine();//ushortushort e = 18910;Console.WriteLine("ushort...");Console.WriteLine("e = " + e);Console.WriteLine("type of variable = " + e.GetType());Console.WriteLine("size of ushort = " + sizeof(short));Console.WriteLine("Min value of ushort = " + ushort.MinValue);Console.WriteLine("Max value of ushort = " + ushort.MaxValue);Console.WriteLine();//intint f = -893818910;Console.WriteLine("int...");Console.WriteLine("f = " + f);Console.WriteLine("type of variable = " + f.GetType());Console.WriteLine("size of int = " + sizeof(int));Console.WriteLine("Min value of int = " + int.MinValue);Console.WriteLine("Max value of int = " + int.MaxValue);Console.WriteLine();//uintint g = 893818910;Console.WriteLine("uint...");Console.WriteLine("g = " + g);Console.WriteLine("type of variable = " + g.GetType());Console.WriteLine("size of uint = " + sizeof(uint));Console.WriteLine("Min value of uint = " + uint.MinValue);Console.WriteLine("Max value of uint = " + uint.MaxValue);Console.WriteLine();//longlong h = -90909893818910;Console.WriteLine("long...");Console.WriteLine("h = " + h);Console.WriteLine("type of variable = " + h.GetType());Console.WriteLine("size of long = " + sizeof(long));Console.WriteLine("Min value of long = " + long.MinValue);Console.WriteLine("Max value of long = " + long.MaxValue);Console.WriteLine();//ulongulong i = 90909893818910;Console.WriteLine("ulong...");Console.WriteLine("i = " + i);Console.WriteLine("type of variable = " + i.GetType());Console.WriteLine("size of ulong = " + sizeof(ulong));Console.WriteLine("Min value of ulong = " + ulong.MinValue);Console.WriteLine("Max value of ulong = " + ulong.MaxValue);Console.WriteLine();//hit ENTER to exitConsole.ReadLine();}} } .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}}

Output

輸出量

sbyte... a = -10 type of variable = System.SByte size of sbyte = 1 Min value of sbyte = -128 Max value of sbyte = 127byte... b = 10 type of variable = System.Byte size of byte = 1 Min value of byte = 0 Max value of byte = 255char... c = P type of variable = System.Char size of char = 2 Min value of char = 0 Max value of char = 65535short... d = -18910 type of variable = System.Int16 size of short = 2 Min value of short = -32768 Max value of short = 32767ushort... e = 18910 type of variable = System.UInt16 size of ushort = 2 Min value of ushort = 0 Max value of ushort = 65535int... f = -893818910 type of variable = System.Int32 size of int = 4 Min value of int = -2147483648 Max value of int = 2147483647uint... g = 893818910 type of variable = System.Int32 size of uint = 4 Min value of uint = 0 Max value of uint = 4294967295long... h = -90909893818910 type of variable = System.Int64 size of long = 8 Min value of long = -9223372036854775808 Max value of long = 9223372036854775807ulong... i = 90909893818910 type of variable = System.UInt64 size of ulong = 8 Min value of ulong = 0 Max value of ulong = 18446744073709551615

Ref: Integral types table

參考: 整體類型表

翻譯自: https://www.includehelp.com/dot-net/integral-types-of-data-types-in-c-sharp.aspx

c# 整數類型轉byte

總結

以上是生活随笔為你收集整理的c# 整数类型转byte_C#中数据类型的整数类型的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。