如果要检查数字的if条件是C#.net代码后面的浮点数或整数代码 [英] an if condition to check the number is float or integer code in C#.net code behind
本文介绍了如果要检查数字的if条件是C#.net代码后面的浮点数或整数代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要检查Result
= 3.44444
然后检查Result
是int
还是float
form
I want to check if Result
= 3.44444
then check Result
is int
or float
form
推荐答案
如果数据类型odResult
是string
:
使用int32
TryParse 方法 [
If the data type odResult
isstring
:
Use theint32
TryParse method[^] or thefloat
TryParse
method to figure out the type of your value.
E.g.bool result = Int32.TryParse(Result, out number);
So you can use
if (Int32.TryParse(Result, out number))
{
//Then value is integer
}
这篇关于如果要检查数字的if条件是C#.net代码后面的浮点数或整数代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文