怎样引用子函数,其中子函数返回的是一个数组,这样写正确吗?
protected void Page_Load(object sender, EventArgs e)
{ int[] jxshijian = new int[20],jxyongshi=new int[20], jxziyuan = new int[20];
int[,] Chrom=new int[40,20],Lose=new int[40,0];
//调用子函数
Lose =yuanshimubiaozhi(jxshijian, jxziyuan, jxyongshi, Chrom);
}
private int[,] yuanshimubiaozhi( int[] jxshijian,int[] jxziyuan,int[] jxyongshi,int[,] Chrom )
{
int[,] lose=new int[40,0];
//返回数组
return lose;
}
请高手指教!
------解决方案--------------------当然可以啊,返回的其实是地址。
------解决方案--------------------C# code
protected void Page_Load(object sender, EventArgs e)
{
int[] jxshijian = new int[20],jxyongshi=new int[20], jxziyuan = new int[20];
int[,] Chrom=new int[40,20],Lose=new int[40,0];
//调用子函数,就顶一个int二维数组接受就行了啊 就下面就行了
Lose =yuanshimubiaozhi(jxshijian, jxziyuan, jxyongshi, Chrom);
}
private int[,] yuanshimubiaozhi( int[] jxshijian,int[] jxziyuan,int[] jxyongshi,int[,] Chrom )
{
int[,] lose=new int[40,0];
//返回数组
return lose;
}