linux-packaging-mono/mcs/tests/dtest-optional-01.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

60 lines
687 B
C#

using System;
using System.Reflection;
using System.Runtime.InteropServices;
struct S
{
}
public class G<T>
{
public object M1 (T o = default (T))
{
return o;
}
public object M2 ([Optional] T o)
{
return o;
}
}
public class C
{
public static object Test ([Optional] dynamic a)
{
return a;
}
void TestS (S s = default (S))
{
}
object TestD (dynamic o = null)
{
return o;
}
public static int Main ()
{
if (Test () != Missing.Value)
return 1;
dynamic d = new C ();
d.TestS ();
if (d.TestD () != null)
return 2;
d = new G<string> ();
if (d.M1 () != null)
return 3;
if (d.M2 () != null)
return 4;
return 0;
}
}