[mcs] Add codegen for null operator on result of awaited instance expression of prope...
[mono.git] / mcs / tests / gtest-421.cs
1 using System;
2
3 public class OneOff
4 {
5         public static int Main ()
6         {
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;
11         }
12
13         private static T[] Clone<T> (T[] o)
14         {
15                 if (o == null)
16                         return null;
17                 Type t = typeof (T);
18                 if (t.IsValueType)
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 ();
24                         return copy;
25                 } else
26                         throw new ArgumentException ("oops");
27         }
28 }