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

25 lines
413 B
C#

using System;
using System.Linq.Expressions;
public class Test
{
public static int Main ()
{
if (Value<int> () != 0)
return 1;
var v = Value<Test> ();
return 0;
}
static T Value<T> () where T : new ()
{
Expression<Func<T>> e = () => new T ();
var et = e.Body.NodeType;
if (et != ExpressionType.New)
throw new ApplicationException (et.ToString ());
return e.Compile ().Invoke ();
}
}