c#二维数据最大最小值_C#| 打印类型,各种数据类型的最大值和最小值
生活随笔
收集整理的這篇文章主要介紹了
c#二维数据最大最小值_C#| 打印类型,各种数据类型的最大值和最小值
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
c#二維數據最大最小值
In the below example – we are printing types, min value, max value of various data types in C#, like integer data types, floating point data types, Boolean data type, Reference types, Nullable types.
在下面的示例中-我們正在打印C#中各種數據類型的類型,最小值,最大值 ,例如整數數據類型,浮點數據類型,布爾數據類型,引用類型,可空類型。
Program:
程序:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace DataTypes {class MyDataType{public string Show(){return ("MyType");}}class Program{static void Main(string[] args){Console.WriteLine("VALUE TYPE:");Console.WriteLine("---------------------------------------------");Console.WriteLine("Integers:");byte a = 12;Console.WriteLine("byte\tA = {0}\t{1}\t{2}\t{3}", a, typeof(byte), byte.MaxValue, byte.MinValue);sbyte b = 12;Console.WriteLine("sbyte\tB = {0}\t{1}\t{2}\t{3}", b, typeof(sbyte), sbyte.MaxValue, sbyte.MinValue);short c = 12;Console.WriteLine("short\tC = {0}\t{1}\t{2}\t{3}", c, typeof(short), short.MaxValue, short.MinValue);ushort d = 12;Console.WriteLine("ushort\tD = {0}\t{1}\t{2}\t{3}", d, typeof(ushort), ushort.MaxValue, ushort.MinValue);int e = 12;Console.WriteLine("int\tE = {0}\t{1}\t{2}\t{3}", e, typeof(int), int.MaxValue, int.MinValue);uint f = 12;Console.WriteLine("unit\tF = {0}\t{1}\t{2}\t{3}", f, typeof(uint), uint.MaxValue, uint.MinValue);long g = 12;Console.WriteLine("long\tG = {0}\t{1}\t{2}\t{3}", g, typeof(long), long.MaxValue, long.MinValue);ulong h = 12;Console.WriteLine("ulong\tH = {0}\t{1}\t{2}\t{3}", h, typeof(ulong), ulong.MaxValue, ulong.MinValue);Console.WriteLine("\nFloating Point:");float i = 123.34f;Console.WriteLine("float\tI = {0}\t{1}\t{2}\t{3}", i, typeof(float), float.MaxValue, float.MinValue);double j = 123.34;Console.WriteLine("double\tJ = {0}\t{1}\t{2}\t{3}", j, typeof(double), double.MaxValue, double.MinValue);decimal k = 123.34m;Console.WriteLine("decimal\tK = {0}\t{1}\t{2}\t{3}", k, typeof(decimal), decimal.MaxValue, decimal.MinValue);Console.WriteLine("\nText:");char l = 'f';Console.WriteLine("char\tL = {0}\t{1}", l, typeof(char));Console.WriteLine("\nBoolean:");bool m = true;Console.WriteLine("bool\tM = {0}\t{1}", m, typeof(bool));Console.WriteLine("\nREFERENCE TYPE:");Console.WriteLine("---------------------------------------------");string n = "Hello";Console.WriteLine("string\tn = {0}\t{1}", n, typeof(string));object o = 12.34;Console.WriteLine("object\tn = {0}\t{1}", o, typeof(object));MyDataType p = new MyDataType();Console.WriteLine("MyDataType\tp = {0}\t{1}", p.Show(), typeof(MyDataType));int[] q = { 12, 45, 56 };Console.WriteLine("int[]\tq = {0}",typeof(int[]));Console.WriteLine("\nNullable TYPE:");Console.WriteLine("---------------------------------------------");string r = null;Console.WriteLine("string\tr = {0}\t{1}", r, typeof(string));int? s = null;Console.WriteLine("int\ts = {0}\t{1}", s, typeof(int?));Console.ReadKey();}} } .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
輸出量
VALUE TYPE: --------------------------------------------- Integers: byte A = 12 System.Byte 255 0 sbyte B = 12 System.SByte 127 -128 short C = 12 System.Int16 32767 -32768 ushort D = 12 System.UInt16 65535 0 int E = 12 System.Int32 2147483647 -2147483648 unit F = 12 System.UInt32 4294967295 0 long G = 12 System.Int64 9223372036854775807 -9223372036854775808 ulong H = 12 System.UInt64 18446744073709551615 0Floating Point: float I = 123.34 System.Single 3.402823E+38 -3.402823E+38 double J = 123.34 System.Double 1.79769313486232E+308 -1.79769313486232E+308 decimal K = 123.34 System.Decimal 79228162514264337593543950335 -79228162514264337593543950335Text: char L = f System.CharBoolean: bool M = True System.BooleanREFERENCE TYPE: --------------------------------------------- string n = Hello System.String object n = 12.34 System.Object MyDataType p = MyType DataTypes.MyDataType int[] q = System.Int32[]Nullable TYPE: --------------------------------------------- string r = System.String int s = System.Nullable`1[System.Int32]翻譯自: https://www.includehelp.com/dot-net/print-type-max-and-min-value-of-various-data-types.aspx
c#二維數據最大最小值
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的c#二维数据最大最小值_C#| 打印类型,各种数据类型的最大值和最小值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java GregorianCalend
- 下一篇: c# 命名空间命名规范_C#命名空间能力