<分区>
我有 3 个变量都声明为“Int16”类型,但这段代码无法运行。
private Int16 _cap; // Seat Capacity
private Int16 _used; // Seats Filled
private Int16 _avail; // Seats Available
public Int16 SeatsTotal {
get {
return _cap;
}
set {
_cap = value;
_used = _cap - _avail;
}
}
除了我有 _used = _cap - _avail;
的部分抛出这个错误,Error
1 Cannot implicitly convert type 'int' to 'short'. An explicit conversion exists (are you missing a cast?)