Click here to Skip to main content
15,925,440 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Memory allocation / GC issues??? Pin
Xpnctoc24-Aug-07 8:59
Xpnctoc24-Aug-07 8:59 
AnswerRe: Memory allocation / GC issues??? Pin
Luc Pattyn25-Aug-07 0:04
sitebuilderLuc Pattyn25-Aug-07 0:04 
GeneralRe: Memory allocation / GC issues??? Pin
Xpnctoc25-Aug-07 4:14
Xpnctoc25-Aug-07 4:14 
AnswerRe: Memory allocation / GC issues??? Pin
#realJSOP25-Aug-07 3:13
professional#realJSOP25-Aug-07 3:13 
GeneralRe: Memory allocation / GC issues??? Pin
Xpnctoc25-Aug-07 4:14
Xpnctoc25-Aug-07 4:14 
GeneralRe: Memory allocation / GC issues??? Pin
Luc Pattyn25-Aug-07 8:12
sitebuilderLuc Pattyn25-Aug-07 8:12 
GeneralRe: Memory allocation / GC issues??? Pin
Scott Dorman26-Aug-07 3:09
professionalScott Dorman26-Aug-07 3:09 
AnswerRe: Memory allocation / GC issues??? Pin
Vaibhav Sharma26-Aug-07 16:54
Vaibhav Sharma26-Aug-07 16:54 
Hi,

I am amazed that after reading all the replies and posts on this article no one mentions of the Using...End Using code block.

I am sure you must be knowing it but just a little bit of detailing on the using statements:

'VB Version, C# no different, just lang. changes<br />
Using dlgOpen As New OpenFileDialog()<br />
    dlgOpen.Filter="*.*"    <br />
    'Any other properties<br />
    dlg.ShowDialog()<br />
End Using


Now what the above code fragment does is that the CLR will create the dlgOpen object and will be responsible for its disposal, not YOU.
This has serious benefits in terms of Performance & Memory Utilization since as soon as the code execution reaches End Using the dlgOpen will be Disposed off without requiring you to do any thing at all.

:::One Catch Though While using the Using statements:::
the dlgOpen will not be accessible outside the Using block since its scope is limited is to the Using...End Using block.

So i strongly recommend you to go ahead and use the Using...End Using blocks for all the DialogBoxes since most of them times they return only one value which can easily be stored on a local/global variable.

Awaiting reply eagerly.


Regards,
Vaibhav Sharma

GeneralRe: Memory allocation / GC issues??? Pin
Xpnctoc26-Aug-07 17:24
Xpnctoc26-Aug-07 17:24 
QuestionEmbedded resources -- pros & cons Pin
Xpnctoc24-Aug-07 4:16
Xpnctoc24-Aug-07 4:16 
AnswerRe: Embedded resources -- pros & cons Pin
Luc Pattyn24-Aug-07 4:54
sitebuilderLuc Pattyn24-Aug-07 4:54 
GeneralRe: Embedded resources -- pros & cons Pin
Xpnctoc24-Aug-07 8:43
Xpnctoc24-Aug-07 8:43 
GeneralRe: Embedded resources -- pros & cons Pin
Luc Pattyn24-Aug-07 12:48
sitebuilderLuc Pattyn24-Aug-07 12:48 
Questionglobal.asax session help Pin
boyindie24-Aug-07 0:32
boyindie24-Aug-07 0:32 
AnswerRe: global.asax session help Pin
saniy24-Aug-07 3:25
saniy24-Aug-07 3:25 
GeneralRe: global.asax session help Pin
boyindie24-Aug-07 3:42
boyindie24-Aug-07 3:42 
Questionvc++.net Books Pin
trinadh_t23-Aug-07 19:40
trinadh_t23-Aug-07 19:40 
AnswerRe: vc++.net Books Pin
George L. Jackson24-Aug-07 15:21
George L. Jackson24-Aug-07 15:21 
JokeRe: vc++.net Books Pin
Paul Conrad27-Aug-07 16:11
professionalPaul Conrad27-Aug-07 16:11 
GeneralRe: vc++.net Books Pin
George L. Jackson28-Aug-07 0:06
George L. Jackson28-Aug-07 0:06 
QuestionHow to avoid the .net framework after the installer has been made? Pin
dhami_naresh23-Aug-07 16:24
dhami_naresh23-Aug-07 16:24 
AnswerRe: How to avoid the .net framework after the installer has been made? Pin
Mark Churchill23-Aug-07 20:20
Mark Churchill23-Aug-07 20:20 
GeneralRe: How to avoid the .net framework after the installer has been made? Pin
dhami_naresh24-Aug-07 6:03
dhami_naresh24-Aug-07 6:03 
GeneralRe: How to avoid the .net framework after the installer has been made? Pin
dhami_naresh26-Aug-07 8:05
dhami_naresh26-Aug-07 8:05 
GeneralRe: How to avoid the .net framework after the installer has been made? Pin
Scott Dorman26-Aug-07 10:47
professionalScott Dorman26-Aug-07 10:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.