예제 #1
0
        private static void Integral()
        {
            // for interoperability
            sbyte sbi = 4;
            short si  = 5;
            // First-class citizen
            int  i    = 6;                      // default
            long li   = 7L;
            var  defi = 9;                      // int/Int32

            System.Numerics.BigInteger bi = 11; // 16byte/128bit  System.Int128?

            Console.WriteLine("\nSigned integral underlying type:");
            Console.WriteLine($"sbyte \t{sbi.GetType()} \t{Marshal.SizeOf(sbi)}");
            Console.WriteLine($"short \t{si.GetType()} \t{Marshal.SizeOf(si)}");
            Console.WriteLine($"int \t{i.GetType()} \t{Marshal.SizeOf(i)}");
            Console.WriteLine($"long \t{li.GetType()} \t{Marshal.SizeOf(li)}");
            Console.WriteLine($"default\t{defi.GetType()} \t{Marshal.SizeOf(defi)}");
            Console.WriteLine($"BigInteger\t{bi.GetType()} \t{Marshal.SizeOf(bi)}");
        }