如何在C#中的智能设备(移动设备)中使用Double.TryParse [英] how to use Double.TryParse in smart device(mobile) in C#
本文介绍了如何在C#中的智能设备(移动设备)中使用Double.TryParse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我正在使用C#在智能设备中开发应用程序,因为我使用了Double.TryParse
,并且出现错误:"double"不包含"TryParse"的定义.请为此发送代码.
我的代码是:
注意:鉴于第一个答案不起作用,我尝试过:
Hello,
I''m developing a application in Smart Device using C# in that I used Double.TryParse
and it is giving error: ''double'' does not contain a definition for ''TryParse''. Please send code for this.
My code is:
NOTE: Given that first answer is not working I tried:
private void MapCurrentLocBtn_Click(object sender, EventArgs e)
{
double lat, lon;
if (internetConnected && Double.TryParse(currentLatitudeTbx.Text, out lat)
&& Double.TryParse(currentLongitudeTbx.Text, out lon))
}
推荐答案
您可以在try catch中尝试使用double.Parse或Convert.ToDouble吗?
You could try the double.Parse or Convert.ToDouble in a try catch ?
如果C#Compact Edition不支持Convert.ToDouble或double.Parse,所以据我所知,它几乎是无用的.您可能做错了什么.
If C# Compact Edition does not support Convert.ToDouble, or double.Parse, then it''s pretty close to useless as far as I can see. you must be doing something wrong.
您可以尝试System.Convert
,但我想没有运气.
可能您必须自己执行解析.
:)
You may trySystem.Convert
, but, I guess, without luck.
Possibly you have to perform yourself the parsing.
:)
这篇关于如何在C#中的智能设备(移动设备)中使用Double.TryParse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文