c# 可以把变量toString,toLower等 ,例如 int n=5; string s= n.toString(); 这个 n为什么可以点出toString()呢,想学着这样写些本人用的例如 toInt(), isNullOrEmpty(), isZero() 等等,方便使用。

解决方案
20
都是在struct里直接定义的
不过你可以在静态类里定义
public static int toInt(this string str)
{
//implementation
}
这样的静态方法来扩展
不过你可以在静态类里定义
public static int toInt(this string str)
{
//implementation
}
这样的静态方法来扩展