public partial class L2SEntity {
public void Scale(double d) {
if (this.Amount.HasValue)
this.Amount.Value *= d;
}
}
导致以下错误:
Error 2 Property or indexer 'System.Nullable<double>.Value' cannot be assigned to -- it is read only
如何更改金额( double 类型?)值?
最佳答案
直接赋值即可。
public partial class L2SEntity {
public void Scale(double d) {
if (this.Amount.HasValue) {
this.Amount *= d;
}
}
}
关于c#-4.0 - 如何修改可空类型的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3397350/