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

33 lines
507 B
C#

using System;
namespace MonoBugs
{
public struct Foo<T>
{
public T Item;
}
public static class Bar
{
public static void DoStuff<T> (T item, Action<T> fn)
{
throw new ApplicationException ("failed");
}
public static void DoStuff<T> (T? item, Action<T> fn)
where T : struct
{
fn (item.Value);
}
}
public static class Program
{
public static void Main ()
{
Foo<int>? value = new Foo<int> { Item = 3 };
Bar.DoStuff (value, x => Console.WriteLine (x.Item));
}
}
}