static void Main(string[] args) { ushort first = 52130; short second = -115; int third = 4825932; sbyte fourth = 97; short fifth = -10000; short sixth = -20000; byte seventh = 224; int eight = 970700000; sbyte ninth = 112; sbyte tenth = -44; int eleventh = -1000000; short twelfth = 1990; long thirteenth = 123456789123456789; Console.WriteLine(first + " -> " + first.GetTypeCode()); Console.WriteLine(second + " -> " + second.GetTypeCode()); Console.WriteLine(third + " -> " + third.GetTypeCode()); Console.WriteLine(fourth + " -> " + fourth.GetTypeCode()); Console.WriteLine(fifth + " -> " + fifth.GetTypeCode()); Console.WriteLine(sixth + " -> " + sixth.GetTypeCode()); Console.WriteLine(seventh + " -> " + seventh.GetTypeCode()); Console.WriteLine(eight + " -> " + eight.GetTypeCode()); Console.WriteLine(ninth + " -> " + ninth.GetTypeCode()); Console.WriteLine(tenth + " -> " + tenth.GetTypeCode()); Console.WriteLine(eleventh + " -> " + eleventh.GetTypeCode()); Console.WriteLine(twelfth + " -> " + twelfth.GetTypeCode()); Console.WriteLine(thirteenth + " -> " + thirteenth.GetTypeCode()); }
static void Main(string[] args) { Utility.Inizia(); byte v1 = new byte(); v1 = 10; Console.WriteLine("{0,-16:X}|{1}|{2}", v1.GetHashCode(), v1.GetType(), v1.GetTypeCode()); sbyte v2 = new sbyte(); v2 = 11; Console.WriteLine("{0,-16:X}|{1}|{2}", v2.GetHashCode(), v2.GetType(), v2.GetTypeCode()); short v3 = new short(); v3 = 12; Console.WriteLine("{0,-16:X}|{1}|{2}", v3.GetHashCode(), v3.GetType(), v3.GetTypeCode()); ushort v4 = new ushort(); v4 = 13; Console.WriteLine("{0,-16:X}|{1}|{2}", v4.GetHashCode(), v4.GetType(), v4.GetTypeCode()); float v5 = new float(); v5 = 14.0F; Console.WriteLine("{0,-16:X}|{1}|{2}", v5.GetHashCode(), v5.GetType(), v5.GetTypeCode()); double v6 = new double(); v6 = 14.0D; Console.WriteLine("{0,-16:X}|{1}|{2}", v6.GetHashCode(), v6.GetType(), v6.GetTypeCode()); decimal v7 = new decimal(); v7 = 15.0M; Console.WriteLine("{0,-16:X}|{1}|{2}", v7.GetHashCode(), v7.GetType(), v7.GetTypeCode()); Console.WriteLine("The size of sbyte is {0}.", sizeof(sbyte)); Console.WriteLine("The size of byte is {0}.", sizeof(byte)); Console.WriteLine("The size of short is {0}.", sizeof(short)); Console.WriteLine("The size of ushort is {0}.", sizeof(ushort)); Console.WriteLine("The size of int is {0}.", sizeof(int)); Console.WriteLine("The size of uint is {0}.", sizeof(uint)); Console.WriteLine("The size of long is {0}.", sizeof(long)); Console.WriteLine("The size of ulong is {0}.", sizeof(ulong)); Console.WriteLine("The size of char is {0}.", sizeof(char)); Console.WriteLine("The size of float is {0}.", sizeof(float)); Console.WriteLine("The size of double is {0}.", sizeof(double)); Console.WriteLine("The size of decimal is {0}.", sizeof(decimal)); Console.WriteLine("The size of bool is {0}.", sizeof(bool)); Utility.Ferma(); }
static void Main() { ushort var1 = 52130; sbyte var2 = -115; int var3 = 4825923; sbyte var4 = 97; short var5 = -10000; Console.WriteLine("52130 = {0}; \n-115 = {1}; \n4825923 = {2}; \n97 = {3}; \n-1000 = {4};" , var1.GetTypeCode(), var2.GetTypeCode(), var3.GetTypeCode(), var4.GetTypeCode(), var5.GetTypeCode()); }
static void Main(string[] args) { ushort first = 52130; sbyte second = -115; int third = 4825932; byte fourth = 97; short fifth = -10000; Console.WriteLine(first + " -> " + first.GetTypeCode()); Console.WriteLine(second + " -> " + second.GetTypeCode()); Console.WriteLine(third + " -> " + third.GetTypeCode()); Console.WriteLine(fourth + " -> " + fourth.GetTypeCode()); Console.WriteLine(fifth + " -> " + fifth.GetTypeCode() + Environment.NewLine); }
static void Main() { ushort var1 = 52130; sbyte var2 = -115; int var3 = 4825932; byte var4 = 97; short var5 = -10000; Console.WriteLine("Var1: type = {0}; value = {1}", var1.GetTypeCode(), var1); Console.WriteLine("Var2: type = {0}; value = {1}", var2.GetTypeCode(), var2); Console.WriteLine("Var3: type = {0}; value = {1}", var3.GetTypeCode(), var3); Console.WriteLine("Var4: type = {0}; value = {1}", var4.GetTypeCode(), var4); Console.WriteLine("Var5: type = {0}; value = {1}", var5.GetTypeCode(), var5); }
static void Main() { Console.Title = "Variables"; byte byteVar = 97; sbyte sbyteVar = -115; short shortVar = -10000; ushort ushortVar = 52130; uint uintVar = 4825932; Console.WriteLine("The type number is:"); Console.WriteLine(new string('=', 40)); Console.WriteLine("{0, 8} --> {1}", byteVar, byteVar.GetTypeCode()); Console.WriteLine("{0, 8} --> {1}", sbyteVar, sbyteVar.GetTypeCode()); Console.WriteLine("{0, 8} --> {1}", shortVar, shortVar.GetTypeCode()); Console.WriteLine("{0, 8} --> {1}", ushortVar, ushortVar.GetTypeCode()); Console.WriteLine("{0, 8} --> {1}", uintVar, uintVar.GetTypeCode()); }