Click here to Skip to main content
15,920,629 members
Home / Discussions / C#
   

C#

 
GeneralRe: Application.Exit Pin
George_George26-Apr-08 22:47
George_George26-Apr-08 22:47 
GeneralRe: Application.Exit Pin
Urs Enzler26-Apr-08 22:55
Urs Enzler26-Apr-08 22:55 
GeneralRe: Application.Exit Pin
George_George26-Apr-08 22:58
George_George26-Apr-08 22:58 
GeneralRe: Application.Exit Pin
MarkB77726-Apr-08 23:41
MarkB77726-Apr-08 23:41 
GeneralRe: Application.Exit Pin
George_George26-Apr-08 23:45
George_George26-Apr-08 23:45 
GeneralRe: Application.Exit Pin
Luc Pattyn27-Apr-08 0:35
sitebuilderLuc Pattyn27-Apr-08 0:35 
GeneralRe: Application.Exit Pin
George_George27-Apr-08 1:44
George_George27-Apr-08 1:44 
GeneralRe: Application.Exit Pin
Luc Pattyn27-Apr-08 4:45
sitebuilderLuc Pattyn27-Apr-08 4:45 
Hi George,

1.
yes Environment.Exit() will clean up and avoid leaks.
Everything that terminates a process will clean up the resources allocated by
the process itself, that is basic functionality in Windows itself.

Nevertheless, it is good practice to do it explicitly;
and you should clean up if your program has two or more parts that are rather
independent, so after part 1 you could and should clean up before starting
part 2, so part 2 gets a maximum of available resources (memory, handles, whatever)
and hence gets the best performance.

2.

George_George wrote:
finally blocks are executed)?


Why don't you try it? you really should replace some of your questions by
looking it up yourself and/or testing it yourself. Here is enough code to
figure it out (put it in e.g. a button click handler):

try {
	Application.Exit();
} finally {
	StreamWriter tw=File.CreateText("finally.txt");
	tw.Close();
}


Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.


GeneralRe: Application.Exit Pin
George_George27-Apr-08 17:17
George_George27-Apr-08 17:17 
GeneralRe: Application.Exit Pin
Luc Pattyn27-Apr-08 20:22
sitebuilderLuc Pattyn27-Apr-08 20:22 
GeneralRe: Application.Exit Pin
George_George27-Apr-08 20:38
George_George27-Apr-08 20:38 
GeneralRe: Application.Exit Pin
Luc Pattyn27-Apr-08 23:42
sitebuilderLuc Pattyn27-Apr-08 23:42 
GeneralRe: Application.Exit Pin
George_George28-Apr-08 1:23
George_George28-Apr-08 1:23 
GeneralRe: Application.Exit Pin
Luc Pattyn28-Apr-08 2:28
sitebuilderLuc Pattyn28-Apr-08 2:28 
GeneralRe: Application.Exit Pin
George_George28-Apr-08 3:52
George_George28-Apr-08 3:52 
GeneralRe: Application.Exit Pin
Luc Pattyn28-Apr-08 4:26
sitebuilderLuc Pattyn28-Apr-08 4:26 
GeneralRe: Application.Exit Pin
George_George28-Apr-08 4:47
George_George28-Apr-08 4:47 
GeneralRe: Application.Exit Pin
PIEBALDconsult27-Apr-08 4:18
mvePIEBALDconsult27-Apr-08 4:18 
GeneralRe: Application.Exit Pin
George_George27-Apr-08 4:24
George_George27-Apr-08 4:24 
GeneralEdit and continue feature Pin
George_George26-Apr-08 22:06
George_George26-Apr-08 22:06 
GeneralRe: Edit and continue feature Pin
Urs Enzler26-Apr-08 22:42
Urs Enzler26-Apr-08 22:42 
GeneralRe: Edit and continue feature Pin
George_George26-Apr-08 22:49
George_George26-Apr-08 22:49 
GeneralRe: Edit and continue feature Pin
Anthony Mushrow27-Apr-08 0:37
professionalAnthony Mushrow27-Apr-08 0:37 
GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 1:42
George_George27-Apr-08 1:42 
GeneralRe: Edit and continue feature Pin
Anthony Mushrow27-Apr-08 2:10
professionalAnthony Mushrow27-Apr-08 2:10 

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.