Topics: Developer Forum
Jan 23, 2007 at 1:14 PM
Hi, I've implemented PreferenceVariableAttribute. You should use it instead of the old GetPreferenceVariable. I'm going to use it in the help generation commands.

You need to be aware of the following things:
- it supports only reference types, Nullable<T> and SwitchParameters. You must use Nullable type for the property when you need a value-type preference variable.
- the preference variable is loaded only when the property is null (or false for switch parameters)
- the preferences are loaded in PscxCmdlet.BeginProcessing. make sure your cmdlet calls that implementation before it uses any of the preference properties.
Jan 23, 2007 at 5:50 PM
I take it the decorated property requires a setter for this attribute to work?
Jan 23, 2007 at 8:02 PM
yeah, exactly. but there is not much use for a get-only parameter anyway, is it?