C# 4.0 如何修改可空类型';s值多少?
导致以下错误:C# 4.0 如何修改可空类型';s值多少?,c#-4.0,nullable,C# 4.0,Nullable,导致以下错误: public partial class L2SEntity { public void Scale(double d) { if (this.Amount.HasValue) this.Amount.Value *= d; } } 无法将错误2属性或索引器'System.Nullable.Value'分配给--它是只读的 如何更改金额的(双重类型?)值?直接分配即可 Error 2 Property or in
public partial class L2SEntity {
public void Scale(double d) {
if (this.Amount.HasValue)
this.Amount.Value *= d;
}
}
无法将错误2属性或索引器'System.Nullable.Value'分配给--它是只读的
如何更改金额的(双重类型?)值?直接分配即可
Error 2 Property or indexer 'System.Nullable<double>.Value' cannot be assigned to -- it is read only
或者一个太少的
{
:-)已更正。
public partial class L2SEntity {
public void Scale(double d) {
if (this.Amount.HasValue) {
this.Amount *= d;
}
}
}