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

38 lines
620 B
C#

using System;
using System.Reflection;
using System.Runtime.InteropServices;
struct BI
{
public static implicit operator BI (int i)
{
return new BI ();
}
}
class C
{
public static void M ([DefaultParameterValue (1 + 3)]BI step)
{
}
public static void M2 ([DefaultParameterValue (1)] object o)
{
}
public static int Main ()
{
var m = typeof (C).GetMethod ("M");
var p = m.GetParameters ()[0];
Console.WriteLine (p.Attributes);
if (p.Attributes != ParameterAttributes.HasDefault)
return 2;
if ((int) p.DefaultValue != 4)
return 1;
Console.WriteLine (p.DefaultValue);
return 0;
}
}