public static int[] Func(int[] m, int[] n)
{
if (m == null || n == null)
{
throw new ArgumentException("传入数组不能为空");
}
int[] result = new int[m.Length + n.Length];
int mIndex = 0;
int nIndex = 0;
for (int index = 0; index < result.Length; index++)
{
if (mIndex >= m.Length)
{
result[index] = n[nIndex];
continue;
}
if (nIndex >= n.Length)
{
result[index] = m[mIndex];
continue;
}
if (m[mIndex] < n[nIndex])
{
result[index] = m[mIndex];
mIndex++;
}
else
{
result[index] = n[nIndex];
nIndex++;
}
}
return result;
}