首页 > Windows开发 > 详细

C#-Tips

时间:2020-07-09 00:44:05      阅读:97      评论:0      收藏:0      [点我收藏+]

C#-Tips

July 8, 2020 11:51 PM

C#调用C++ 参数void*

c# ref
C++ &

c# 判断输入数据类型

Convert.ToInt64(),如果参数非数值会异常,需要try catch
  • tryParse

  • GetType()

int   i   =   5;
Console.WriteLine( "i is an int? {0}",i.GetType()==typeof(int));
Console.WriteLine( "i is an int? {0}",typeof(int).IsInstanceOfType(i));
  • 正则表达式
public static bool IsNumeric(string value)
{
    return Regex.IsMatch(value, @"^[+-]?/d*[.]?/d*$");
}
public static bool IsInt(string value)
{
    return Regex.IsMatch(value, @"^[+-]?/d*$");
}
public static bool IsUnsign(string value)
{
    return Regex.IsMatch(value, @"^/d*[.]?/d*$");
}

C#-Tips

原文:https://www.cnblogs.com/yongchao/p/13270077.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!