private void button22_Click(object sender, System.EventArgs e)
{
string x = "MM";
int y = 12;
increase(x);
increase(y);
MessageBox.Show(x);
MessageBox.Show(y.ToString());
} private void increase(ref object x)
{
if(x == System.Type.GetType("string"))
x = "QQ";
else
x = 13;
}咋个实现修改x y的值哦?
{
string x = "MM";
int y = 12;
increase(x);
increase(y);
MessageBox.Show(x);
MessageBox.Show(y.ToString());
} private void increase(ref object x)
{
if(x == System.Type.GetType("string"))
x = "QQ";
else
x = 13;
}咋个实现修改x y的值哦?
{
string x = "MM";
object x1 = x;
int y = 12;
object y1 = y;
increase( ref x1);
increase(ref y1);
MessageBox.Show(x);
MessageBox.Show(y.ToString()); }
{
object x = "MM";
object y = 12;
increase(ref x);
increase(ref y);
MessageBox.Show(x);
MessageBox.Show(y.ToString()); }
private static void increase(ref object x)
{
if (x.GetType() == Type.GetType("System.String"))
x = "QQ";
else
x = 13;
}
{
string x = "MM";
int y = 12;
x= increase(x).ToString();
y = Convert.ToInt32(increase(y));
MessageBox.Show(x);
MessageBox.Show(y.ToString()); } private object increase(object x)
{
if (x.GetType().Name.ToLower() == "string")
x = "QQ";
else
x = 13;
return x;
}