【发布时间】:2011-03-23 00:04:07
【问题描述】:
class Program
{
static void Main(string[] args)
{
Int64 a = Int64.MaxValue;
Int64 b= Int64.MinValue;
try
{
checked
{
Int64 m = a * b;
}
}
catch (OverflowException ex)
{
Console.WriteLine("over flow exception");
Console.Read();
}
}
}
如果变量声明为 int,我得到编译错误,需要从 int 转换为 long。
- 为什么我使用 int 时会出现此错误。
- 别名
Int32和Int64是什么 - 何时使用
Int32和Int64,是否取决于操作系统?
【问题讨论】:
标签: c#