将两个数组传递给插入函数 [英] pass two arrays to an insert function
本文介绍了将两个数组传递给插入函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想知道如何将两个不同的数组传递给一个函数.
谢谢
Hi all,
I want to know how to pass two different arrays to one function.
Thanks
推荐答案
如果您的意思是如何将两个数组传递给一个方法,则假定您的方法签名如下:
If you mean how to pass two arrays to a method, assuming your method signature is as follows:
public void SampleMethod(string[] a, string[] b)
{
}
您可以这样做:
You could do it a bit like this:
var array1 = new [] {"adasd", "asdasd"};
var array2 = new [] {"werewr", "werewr"};
SampleMethod(array1, array2);
public void MethodPassingTwoDifferentArrays()
{
int[] myFirstArray = new int[0];
int[] mySecondArray = new int[100];
MethodAcceptingTwoArrays(myFirstArray, mySecondArray )
}
public void MethodAcceptingTwoArrays(int[] arr1, int[] arr2)
{
// Play with the arrays, but no dirty business!
}
这篇关于将两个数组传递给插入函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文