C# 验证数字及字符串
今天无意间发现一种验证数字及字符串的方式:
验证字符串:
if ("asdf" is string)
{
MessageBox.Show("asdf是字符串");
}
验证数字:
if (12.GetType()==typeof(Int32))
{
MessageBox.Show("12是数字");
}
发布时间: 2012-09-02 21:00:34 作者: rapoo
C# 验证数字及字符串
今天无意间发现一种验证数字及字符串的方式:
验证字符串:
if ("asdf" is string)
{
MessageBox.Show("asdf是字符串");
}
验证数字:
if (12.GetType()==typeof(Int32))
{
MessageBox.Show("12是数字");
}