I have a base class that has a bool property which looks like this:
public abstract class MyBaseClass
{
public bool InProgress { get; protected set; }
}
Although the solution by @Me.Name is completely valid by itself, there's an additional trick that may come in handy in some situations (it certainly did for me): if you're converting multiple lambdas using this technique, you can factor the cast as a helper method, along the lines of
object myDelegateToObject ( Action action ) {
return action; // autocast to `object` superclass, no explicit cast needed
}
and then call it by simply
dict.Add("InProgress", myDelegateToObject(InProgress => base.InProgress = InProgress));
It may save you time later on - if you decide to change to change the signatures, you will have to do so in one place only.