Click here to Skip to main content
15,891,204 members
Home / Discussions / C#
   

C#

 
AnswerRe: Catch vb6 errorcodes as Exceptions in C# Pin
Christian Graus30-Jul-08 21:28
protectorChristian Graus30-Jul-08 21:28 
GeneralRe: Catch vb6 errorcodes as Exceptions in C# Pin
dewaldf30-Jul-08 21:39
dewaldf30-Jul-08 21:39 
Questionproblem creating files with iso-8859-2 encoding Pin
cellardoor071630-Jul-08 21:11
cellardoor071630-Jul-08 21:11 
AnswerRe: problem creating files with iso-8859-2 encoding Pin
Guffa30-Jul-08 21:36
Guffa30-Jul-08 21:36 
GeneralRe: problem creating files with iso-8859-2 encoding Pin
cellardoor071630-Jul-08 21:46
cellardoor071630-Jul-08 21:46 
GeneralRe: problem creating files with iso-8859-2 encoding Pin
Guffa30-Jul-08 23:47
Guffa30-Jul-08 23:47 
GeneralRe: problem creating files with iso-8859-2 encoding Pin
cellardoor071631-Jul-08 0:34
cellardoor071631-Jul-08 0:34 
QuestionWhere do I release my object's expensive resources, if not in the destructor? Pin
JoeRip30-Jul-08 20:57
JoeRip30-Jul-08 20:57 
I have an object that creates an expensive COM object as soon as my object's Constructor is called. This COM object is treated as a private field in my object.

My object is then responsible releasing that COM object. Not releasing it is expensive and problematic.

So I put the release code for the COM object in my object's destructor, assuming my object's destructor would be called as soon as my object was set to NULL or went out of scope. However, this is not the case. My object's destructor is not called until the garbage collector runs.

This is a problem. I need my object to release the COM object as soon as it's not needed anymore. If I don't, there are problems with the COM server application - ie, it won't close, etc.

How can I insure that my object releases the COM object as soon as my object is set to null, or goes out of scope? Where do I put the COM release code?
AnswerRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Christian Graus30-Jul-08 20:58
protectorChristian Graus30-Jul-08 20:58 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
JoeRip30-Jul-08 21:09
JoeRip30-Jul-08 21:09 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
JoeRip30-Jul-08 21:10
JoeRip30-Jul-08 21:10 
AnswerRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Guffa30-Jul-08 21:40
Guffa30-Jul-08 21:40 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
JoeRip30-Jul-08 21:44
JoeRip30-Jul-08 21:44 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Frank Horn31-Jul-08 3:24
Frank Horn31-Jul-08 3:24 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Christian Graus30-Jul-08 23:55
protectorChristian Graus30-Jul-08 23:55 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Scott Dorman2-Aug-08 15:26
professionalScott Dorman2-Aug-08 15:26 
AnswerRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Alan Balkany31-Jul-08 3:23
Alan Balkany31-Jul-08 3:23 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
JoeRip31-Jul-08 3:26
JoeRip31-Jul-08 3:26 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Alan Balkany31-Jul-08 4:17
Alan Balkany31-Jul-08 4:17 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Scott Dorman2-Aug-08 15:32
professionalScott Dorman2-Aug-08 15:32 
GeneralRe: Where do I release my object's expensive resources, if not in the destructor? Pin
Scott Dorman2-Aug-08 15:23
professionalScott Dorman2-Aug-08 15:23 
QuestionCannot debug c# dll Pin
manju#12330-Jul-08 20:36
manju#12330-Jul-08 20:36 
AnswerRe: Cannot debug c# dll Pin
Christian Graus30-Jul-08 20:59
protectorChristian Graus30-Jul-08 20:59 
Questionhow many rows and columns are hidden in an excel sheet Pin
Mogaambo30-Jul-08 20:20
Mogaambo30-Jul-08 20:20 
Question'switch' statement efficiency in C# Pin
scody30-Jul-08 19:50
scody30-Jul-08 19:50 

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.