The current solution that works is
gameObject.GetComponent<ParticleSystem>().startSize = 1
but VStudio 2017 reports that startSize is obsolete and should be replaced with main.startSize. But when I do that, I get an error:
Cannon modify the return value of ParticleSystem.main because it is not a variable.
So how should I set the start size value?