I’ve asked a similar question before but I’m just having a hard time wrapping my head around this…
I have a delegate…
delegate void assertDelegate(params object[] args);
and I have a method that invokes the delegate…
public void assert(assertDelegate assertMethod, params object[] args) {
string expectedValue;
string actualValue;
// derive value of 'expectedValue' and 'actualValue' from 'args'
assertMethod.DynamicInvoke(expectedValue, actualValue);
}
my thought was that there has to be a way to pass the action and dynamically invoke the arguments for that action…
assert(Assert.AreEqual,new object[]{ HtmlDiv.PropertyNames.Id, "footer"});
but I’m getting the error Expected a method with 'void AreEqual(params object[])' signature.
Perhaps I’m misunderstanding DynamicInvoke?
This delegate signature does not match any signature of
Assert.AreEqual.Use instead:
Or a
Func<string, string>.