e = (E)Delegate.CreateDelegate(typeof(E), new C(), "DoExecute");
Assert.NotNull(e);
Assert.Equal(102, e(new C()));
+
+ e = (E)Delegate.CreateDelegate(typeof(E), new B() { field = 42 }, "GetField");
+ Assert.NotNull(e);
+ Assert.Equal(42, e(new C()));
}
[Fact]
public class B
{
+ public int field;
public virtual string retarg3(string s)
{
{
return 3;
}
+
+ public int GetField(C c)
+ {
+ return field;
+ }
}
public class C : B, Iface
return null;
}
- return CreateDelegate_internal(type, null, info, throwOnBindFailure);
+ return CreateDelegate_internal(type, target, info, throwOnBindFailure);
}
[RequiresUnreferencedCode("The target method might be removed")]