private decimal? xposition;
public decimal? XPosition
{
get
{
return this.xposition;
}
set
{
this.xposition = value;
Math.Round(this.xposition, 4);
}
}
为什么我不能在set方法中使用Math.round
?它说:为什么我不能在set方法中使用Math.round#
参数'#1'不能转换'小数?'表达式为'double'
请问您可以粘贴相关代码吗? – Bathsheba
私有小数? xPosition位置; –
私有小数? xPosition位置; \t \t public decimal? x向位置 \t \t { \t \t \t得到 \t \t \t { \t \t \t \t回报this.xposition; \t \t \t} \t \t \t设置 \t \t \t \t {\t \t \t \t \t \t \t this.xposition =值; \t \t \t \t Math.Round(this.xposition,4); \t \t \t \t} \t \t \t \t} –