int,Int16,Int32和Int64用于表示带符号整数,其值的范围取决于其在内存中的容量/占用的大小。这些类型可以使用负值和正值。所有这些类型本质上都是相同的,但是根据值范围而不同。
Int16表示16位(2字节)有符号整数。
Int16在内存中占用16位(2字节)的空间。
按照2字节的数据容量,Int16的值容量为-32768至+32767。
示例
考虑代码–在这里,我们正在打印所需的大小,类型,最小值和最大值,变量声明以及Int16的赋值。
using System;
using System.Text;
namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            //printing Int16 capacity, type, MIN & MAX value
            Console.WriteLine("Int16 occupies {0} bytes", sizeof(Int16));
            Console.WriteLine("Int16 type is: {0}", typeof(Int16));
            Console.WriteLine("Int16 MIN value: {0}", Int16.MinValue);
            Console.WriteLine("Int16 MAX value: {0}", Int16.MaxValue);
            Console.WriteLine();
            //Int16变量
            Int16 a = 12345;
            Int16 b = -12345;
            Console.WriteLine("a = {0}, b = {1}", a, b);
            //按ENTER退出
            Console.ReadLine();
        }
    }
}输出结果
Int16 occupies 2 bytes Int16 type is: System.Int16 Int16 MIN value: -32768 Int16 MAX value: 32767 a = 12345, b = -12345