传入的值为null
static string[] Result2(string p1, string p2="2") { string[] s = new string[] { p1, p2 }; return s; } public string[] Result(string p1, string p2) { return Result2(p1); }
传入的值为""(winform控件textbox不输入传入的就是“”)
public string[] Result1(string p1,string p2) { if (p2 == "") { p2 = "9"; } string[] num = new string[7]; Class2 class2 = new Class2(); for(int i = 0;i<7;i++) { num[i] = $"{p1}---{Convert.ToInt32(p2) + i};}"; } return num; }
本文来自博客园,作者:阿霖找BUG,转载请注明原文链接:https://www.cnblogs.com/lin-07/p/17556124.html