View Single Post
Old 06-01-2006   #5 (permalink)
Staffan Gustafsson


 
 

Re: What's the correct way do design an Exif image information cmdlet?

Can you query for the availability of a property from a script?
Or how do clients handle the "Maybe it's there" nature of the properties?

Any pointer to a place in the SDK that explains how to add a property?

Sounds like something else than a getter/setter in C#...

Regards

/Staffan



"Jeffrey Snover [MSFT]" <jsnover@microsoft.com> wrote in message
news:%23RdAFiXhGHA.1208@TK2MSFTNGP02.phx.gbl...
> As a general rule, PowerShell is loose about missing values. e.g if you
> specify a value that is not there, it returns a null instead of
> complaining. In the latest release, we've added a the ability to say
> Set-PSDebug -STRICT
> This will throw an exception if you try to access a variable that does not
> exist but it still lets you access properties that don't exist (we'll deal
> with this an other features for -STRICT in V2).
>
> As such, you can either add the properties and give then null values or
> NOT add the properties. There are 2 considerations here:
> 1) SETTING. If you ever want to SET the values, then you should add them
> and give them null properties. Setting a property that does not exist
> causes an exception.
> 2) Resource consumption. You'll want to look at how many null properties
> you'll have in the average case. If that is a lot, you might consider not
> adding them.
>
> --
> Jeffrey Snover [MSFT]
> Windows PowerShell Architect
> Microsoft Corporation
> This posting is provided "AS IS" with no warranties, no confers rights.
>



My System SpecsSystem Spec