private
void
Method1()
{
string
[]A={
"1"
,
"2"
,
"3"
,
"4"
,
"5"
};
for
(
int
i = 0; i < A.Length; i++)
{
string
str1=A[i];
Method2();
}
}
private
void
Method2()
{
string
[] B = {
"3"
,
"5"
,
"7"
,
"8"
,
"9"
};
for
(
int
i = 0; i < B.Length; i++)
{
string
str2=B[i];
}
}
传个参就好
private
void
Method1()
{
string
[]A={
"1"
,
"2"
,
"3"
,
"4"
,
"5"
};
for
(
int
i = 0; i < A.Length; i++)
{
string
str1=A[i];
Method2(str1);
}
}
private
void
Method2( str1)
{
string
[] B = {
"3"
,
"5"
,
"7"
,
"8"
,
"9"
};
for
(
int
i = 0; i < B.Length; i++)
{
string
str2=B[i];
}
}
谢谢
private void Method1() { string[] A = { "1", "2", "3", "4", "5" }; for (int i = 0; i < A.Length; i++) { if (i == 0) { Method2(A[i]); } } } private void Method2(string first) { string[] B = { "3", "5", "7", "8", "9" }; for (int i = 0; i < B.Length; i++) { if (first == B[i]) { MessageBox.Show("pass"); } } }
谢谢
一楼就是真确的看一楼的,但最好不要定义太多的私有方法
谢谢