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*$");
}