Click here to Skip to main content
15,906,106 members
Home / Discussions / C#
   

C#

 
GeneralRe: Beginner in C# Pin
Abhijit Jana10-Dec-07 19:08
professionalAbhijit Jana10-Dec-07 19:08 
GeneralRe: Beginner in C# Pin
tasumisra10-Dec-07 19:21
tasumisra10-Dec-07 19:21 
GeneralRe: Beginner in C# Pin
N a v a n e e t h10-Dec-07 19:45
N a v a n e e t h10-Dec-07 19:45 
GeneralRe: Beginner in C# Pin
tasumisra10-Dec-07 19:52
tasumisra10-Dec-07 19:52 
GeneralRe: Beginner in C# Pin
Abhijit Jana10-Dec-07 19:47
professionalAbhijit Jana10-Dec-07 19:47 
QuestionWhat would cause a COM object to lose its RCW? Pin
JoeRip10-Dec-07 14:17
JoeRip10-Dec-07 14:17 
AnswerRe: What would cause a COM object to lose its RCW? Pin
TJoe10-Dec-07 17:24
TJoe10-Dec-07 17:24 
GeneralRe: What would cause a COM object to lose its RCW? Pin
JoeRip10-Dec-07 21:37
JoeRip10-Dec-07 21:37 
When I created a new object during the cast, why would the refcount not increase? How is this different than, say:

TrackObject myTrack = GetTrackObject();<br />
TrackObject mySecondTrack = myTrack;


It seems like in both cases, I would have two objects/variables pointing at the same underlying COM object. Calling ReleaseCOMObject is supposed to decrement the refcount, so calling it on the first TrackObject (myTrack in both examples) shouldn't release the underlying COM object...

ReleaseCOMObject is explained here:
http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.marshal.releasecomobject.aspx

but it seems to contradict itself in places, and I'm not sure how to map it to what I'm doing in code.

Your recommendation about postponing the release: once I leave Method A, I can never go back and release the Track object, since it will have gone out of scope. I could only ever release the casted object, the fileTrack. Since the Track object is out of scope, it will eventually get cleaned up by the GarbageCollector, but this isn't a very effecient management of memory. I'm trying to be a good citizen. Especially since I'm really getting the original Track object in a loop, where I might be getting 12000 Track objects Smile | :)
GeneralRe: What would cause a COM object to lose its RCW? Pin
TJoe11-Dec-07 2:11
TJoe11-Dec-07 2:11 
GeneralCOM in c# [modified] Pin
Dromar10-Dec-07 12:30
Dromar10-Dec-07 12:30 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 13:21
sitebuilderLuc Pattyn10-Dec-07 13:21 
GeneralRe: COM in c# Pin
JoeRip10-Dec-07 14:01
JoeRip10-Dec-07 14:01 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 14:11
sitebuilderLuc Pattyn10-Dec-07 14:11 
GeneralRe: COM in c# Pin
Anthony Mushrow10-Dec-07 14:41
professionalAnthony Mushrow10-Dec-07 14:41 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 14:45
sitebuilderLuc Pattyn10-Dec-07 14:45 
GeneralRe: COM in c# Pin
Anthony Mushrow10-Dec-07 14:51
professionalAnthony Mushrow10-Dec-07 14:51 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 15:42
sitebuilderLuc Pattyn10-Dec-07 15:42 
GeneralRe: COM in c# Pin
Dromar10-Dec-07 14:31
Dromar10-Dec-07 14:31 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 14:42
sitebuilderLuc Pattyn10-Dec-07 14:42 
GeneralRe: COM in c# Pin
Dromar10-Dec-07 15:42
Dromar10-Dec-07 15:42 
GeneralRe: COM in c# Pin
Luc Pattyn10-Dec-07 15:47
sitebuilderLuc Pattyn10-Dec-07 15:47 
QuestionHow to open-with a file using my application ? Pin
ZHM10-Dec-07 11:20
ZHM10-Dec-07 11:20 
GeneralRe: How to open-with a file using my application ? Pin
Luc Pattyn10-Dec-07 11:59
sitebuilderLuc Pattyn10-Dec-07 11:59 
GeneralRe: How to open-with a file using my application ? Pin
Ian Uy10-Dec-07 20:05
Ian Uy10-Dec-07 20:05 
GeneralCreating a Sound(say, a Beep) Pin
polishprogrammer10-Dec-07 11:14
polishprogrammer10-Dec-07 11:14 

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.