e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
31 lines
622 B
C#
31 lines
622 B
C#
using System;
|
|
using System.Linq.Expressions;
|
|
|
|
class X
|
|
{
|
|
class HasAction
|
|
{
|
|
public void Start ()
|
|
{
|
|
}
|
|
}
|
|
|
|
public static int Main ()
|
|
{
|
|
var expectedObject = typeof (HasAction).GetMethod("Start");
|
|
|
|
Expression<Func<HasAction, Action>> methodToUse = r => r.Start;
|
|
|
|
UnaryExpression unary = methodToUse.Body as UnaryExpression;
|
|
MethodCallExpression methodCall = unary.Operand as MethodCallExpression;
|
|
ConstantExpression constantExpression = methodCall.Object as ConstantExpression;
|
|
|
|
if (expectedObject != constantExpression.Value)
|
|
return 1;
|
|
|
|
if (methodCall.Object == null)
|
|
return 2;
|
|
|
|
return 0;
|
|
}
|
|
} |