IDisposable & ImageAttributes

I've been reviewing my code to ensure that all IDisposable objects were being properly disposed of, when I came upon an interesting problem. I tried placing an ImageAttributes object within a using block and was surprised to get the following error upon compiling:

'System.Drawing.Imaging.ImageAttributes': type used in a using statement must be implicitly convertible to 'System.IDisposable'

It turns out that the ImageAttributes class implements IDisposable, but the Dispose() method is not available on the Compact Framework. I really have no idea what to make of this. Is this a bug in the Compact Framework? Do I actually need to dispose of ImageAttributes objects?

While I'm on the topic of IDisposable, I'd like to ask why the documentation for classes doesn't point out that they implement IDisposable via inheritance? Considering how important it is to call Dispose() on IDisposable objects when you are done with them, it'd make sense to have this pointed out more clearly.

Anyways, any advice on how to handle disposing of the ImageAttributes class on the Compact Framework would be greatly appreciated.

Adrien.

[1228 byte] By [AdrienRegimbald] at [2007-12-24]
# 1

Unlike desktop version, this class on NETCF has no native resources to dispose of so no call to Dispose() is needed.

However it should be considered a bug as it breaks desktop compatibility. I’ll file a bug to fix that in next version of NETCF.

IlyaTumanov at 2007-8-31 > top of Msdn Tech,Smart Device Development,Smart Devices VB and C# Projects...
# 2
Thanks for clearing this up for me.

Adrien.

AdrienRegimbald at 2007-8-31 > top of Msdn Tech,Smart Device Development,Smart Devices VB and C# Projects...