What is the correct way to create and set parameters on a material instance dynamic from within a constructor?

I have a base material as an editable property. In the constructor I want to create the mid, set parameters on it, and assign it to a mesh. I’m really banging my head against a wall trying to get it to work though.