5 public static int Main ()
7 double[] darray
= { 1.0, 2.0, 3.0 }
;
8 double[] clone
= OneOff
.Clone (darray
);
9 Console
.WriteLine (clone
.Length
);
10 return clone
.Length
== 3 ? 0 : 1;
13 private static T
[] Clone
<T
> (T
[] o
)
19 return (T
[]) o
.Clone ();
20 else if (t
.IsArray
&& (t
.GetElementType ().IsValueType
|| t
.GetElementType () == typeof (string))) {
21 T
[] copy
= new T
[o
.Length
];
22 for (int i
= 0; i
< o
.Length
; i
++)
23 copy
[i
] = (T
) (o
[i
] as Array
).Clone ();
26 throw new ArgumentException ("oops");