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


 
 

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

In the .NET type system, a DateTime is a ValueType, allocated on the stack,
not on the garbage collected head.

The only way you can get a reference to a DateTime is to box it, but then
you lose the strong typing.


PS > [string] $a=$null
[C:\NeoCode\N2]

PS > [DateTime] $a=$null
Cannot convert null to type "System.DateTime".
At line:1 char:14
+ [DateTime] $a= <<<< $null

/Staffan

"dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message
news:039BA966-540F-415A-ACCC-C4D6BBC8BE68@microsoft.com...
> "Staffan Gustafsson" wrote:
>
>> This could be represented as a DateTime. The problem is that the property
>> is
>> optional in EXIF.
>> If represented as a string, you can allways return null or String.Empty,
>> but
>> then you lose all the goodness of the strong typing.

>
> Uhh, why do you think a DateTime property can't be null?
> If a String can be null, any other object should be able to be null, too.
>
> --
> greetings
> dreeschkind



My System SpecsSystem Spec