linux-packaging-mono/mcs/tests/test-null-operator-14.cs
Xamarin Public Jenkins 6992685b86 Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
2015-11-10 14:54:39 +00:00

42 lines
500 B
C#

using System;
class Test
{
static void Main ()
{
Test_1 ("");
Test_1<object> (null);
Test_2<object> (null);
Test_2 ("z");
Test_2 (0);
Test_2 ((long?) -8);
Test_3 (new int[1]);
Test_3 (new int[] { 5 });
}
static void Test_1<T> (T x) where T : class
{
x?.Call ();
}
static void Test_2<T> (T x)
{
x?.Call ();
}
static void Test_3<T> (T[] x)
{
x[0]?.Call ();
}
}
static class Ext
{
public static void Call<T> (this T t)
{
Console.WriteLine (typeof (T));
}
}