无法将类型'string'隐式转换为'double' [英] can not implicitly convert type 'string' to 'double'

查看:413
本文介绍了无法将类型'string'隐式转换为'double'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我班上有这个

私人双fcs_classwork;

i have this in my class

private double fcs_classwork;

public object coresubjectSecond
       {
           get { return fcs_classwork; }
           set { fcs_classwork = value.ToString(); }
       }



但是我收到此错误消息,无法将类型"string"隐式转换为"double"
请如何解决此问题.



but i get this error meesage can not implicitly convert type ''string'' to ''double''
please how do i solve this.

推荐答案

此处

将fcs_classwork声明为double数据类型.因此,您需要将该值转换为double

Here

the fcs_classwork declared as double data type.So you need to convert the value to double

public object coresubjectSecond
       {
           get { return fcs_classwork; }
           set { fcs_classwork = Convert.ToDouble(value);  }
       }


此处
将fcs_classwork声明为double数据类型.因此,您需要将该值转换为double
Here
the fcs_classwork declared as double data type.So you need to convert the value to double
public object coresubjectSecond
       {
           get { return fcs_classwork; }
           set { fcs_classwork = Convert.ToDouble(value);  }
       }


在代码下使用
using under code
public object coresubjectSecond
       {
           get { return fcs_classwork; }
           set { fcs_classwork = Convert.ToDouble(value);  }
       }


这篇关于无法将类型'string'隐式转换为'double'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆