You've already forked linux-packaging-mono
Imported Upstream version 3.12.0
Former-commit-id: cf92446697332992ec36726e78eb8703e1f259d7
This commit is contained in:
41
mcs/tests/test-null-operator-010.cs
Normal file
41
mcs/tests/test-null-operator-010.cs
Normal file
@ -0,0 +1,41 @@
|
||||
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));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user