传参数多的时候,最好用struct来传。
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
public struct MyStruct
{
public string name;
public int age;
}
class Program
{
static void Main(string[] args)
{
MyStruct myStruct = new MyStruct();
myStruct.name = "ike_li";
myStruct.age = 100;
myclass mc = new myclass();
mc.output(myStruct);
Console.ReadKey();
}
}
class myclass
{
public void output(MyStruct ms)
{
Console.WriteLine(ms.name + ms.age.ToString());
}
}