how to change particle system rate over time unity

Code Example - how to change particle system rate over time unity

                
                        //objectName.GetComponent<ParticleSystem>().emission.rateOverTime = 2.0f;
//This doesn't work, so you need to seperate it into a few lines.
ParticleSystem particleSystem = objectName.GetComponent<ParticleSystem>();
var emission = particleSystem.emission;
emission.rateOverTime = 2.0f;