That depends; does your initialization require the cmdlet's parameter's to be initialized? If you're just doing something like assigning string.Empty
or an all-around default value, you can do it in the constructor. But if you were to do something like
this.s = "Value: " + this.whatever;
you would need to do it in BeginProcessing
, as at that the time in the lifecycle, you're guaranteed to have the parameters bound to the cmdlet's members.