C#-Tips

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

上一篇:C# 默认日期时间点和第二天日期时间点格式


下一篇:风林火山win11 64位官方版iso镜像v2021.07