You need to pass the new value for "MyProperty" as an argument to your Func
Func<MyModel,int, int> func = (x, newValue) =>
{
x.MyProperty = newValue;
return newValue;
};
And use it like this:
var m = new MyModel();
func(m, 2);
Alternatively, if you are not interested in the return value you can turn the Func into and Action:
Action<MyModel,int> func = (x, newValue) => x.MyProperty = newValue;
Also, you can capture the "MyModel" variable in a closure so that you don't pass the instance explicitly every time you want to change "MyProperty"'s value:
var myModel = new MyModel();
Func<MyModel, Action<int>> getSetter = x =>
newValue=>x.MyProperty = newValue;
var setter = getSetter(myModel);
setter(3);
setter(4);