View Single Post
Old 06-01-2006   #3 (permalink)
Jeffrey Snover [MSFT]


 
 

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

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