static T[] merge<T>(params T[][] arrays)
{
int len = 0;
foreach (T[] array in arrays)
{
len += array.Length;
}
T[] result = new T[len];
len = 0;
foreach (T[] array in arrays)
{
foreach (T elem in array)
{
result[len++] = elem;
}
}
return result;
}
Tuesday, February 27, 2007
Generics Puzzler
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment