// nums2.
Console.Write(" nums2: "); foreach(int x in nums2)
Console.Write(x + " ");
Console.WriteLine();
// , copylnsert. string[] strs = {"", "", "."}; string[] strs2 = new string[4];
// strs.
Console.Write(" strs: "); foreach(string s in strs)
Console.Write(s + " ");
Console.WriteLine();
// .
ArrayUtils.Copylnsert(" #", 1, strs, strs2);
// strs2.
Console.Write(" strs2: "); foreach(string s in strs2)
Console.Write(s + " ");
Console.WriteLine();
// , // double, // int.
// ArrayUtils.Copylnsert(0.01, 2, nums, nums2);
}
}
.
nums: 1 2 3 nums2: 1 2 99.3
strs: .
strs2: C# .
CopyInsert(). .
public static bool CopyInsert<T>( e, uint idx,
T[] src, T[] target) {
, . , Copylnsert () , . , , , , . .
, Copylnsert () Main () . , , . . ,
ArrayUtils.Copylnsert (99, 2, nums, nums2);
T int, 99 nums num&2 int. , string.
.
// ArrayUtils.Copylnsert(0.01, 2, nums, nums2);
, . , Copylnsert () double, nums nums2 int. , , , . .
|
|
Copylnsert () . .
_ _<__> (_) {//...
__ . , .
, . . , Copylnsert () string.
ArrayUtils.CopyInsert<string>(" #", 1, strs, strs2);