HighTechTalks DotNet Forums  

do we need to dispose screen controls?

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss do we need to dispose screen controls? in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
Hilton
 
Posts: n/a

Default Re: do we need to dispose screen controls? - 12-24-2007 , 11:23 PM






CF 1.0.4292.0 which is CF1 SP3

Try it, create a Pocket PC, add the line below and on CF 1, it shows false
(and using doesn't compile either).

Hilton



"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote

Quote:
Well you have to believe the runtime. I can only conclude that I'm
looking at the wrong 1.0 binary (or at least not the one your system is
using). What version of 1.0 are you running?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com




"Hilton" <nospam (AT) nospam (DOT) com> wrote in message
news:sunbj.790$6%.199 (AT) nlpi061 (DOT) nbdc.sbc.com...
To follow-up my own post:

When I run (FormDispose.exe) with the line:

"MessageBox.Show (((new Form () is IDisposable).ToString()));"

it returns *false*. This is using CF 1.

Then I add the file FormDispose.exe.config so that FormDispose uses CF 2
and guess what? Yip, it returns *true*.

Believe it, or not...

Hilton



"Hilton" <nospam (AT) nospam (DOT) com> wrote in message
news:IRmbj.784$6%.53 (AT) nlpi061 (DOT) nbdc.sbc.com...
Chris,

I just checked CF 1.0, 2.0 and 3.5 with Reflector and a Form is
definitely derived from IDisposable in all three.

Form->ContainerControl->ScrollableControl->Control->Component->IComponent->IDisposable

OK, so:

Q1: Why does:

using (Form form = new Form()) {}

give the following compiler error:

c:\test\FormDispose\Form1.cs(32): Cannot implicitly convert type
'System.Windows.Forms.Form' to 'System.IDisposable'


...and..

Q2: Why does: "(new Form () is IDisposable)" return false?

Q1 is a compile time check, Q2 is a run-time and they're consistent.

Hilton









Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.