True, and it's rather common to see this in code originally written in VB,
converted to VB.NET and finally translated into C#.
Willy.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
| Also, in a non-debug build, it may actually prolong the lifetime of the
| object.
|
| In the end, that line is pointless.
|
| --
| - Nicholas Paldino [.NET/C# MVP]
| -
mv*@spam.guard.caspershouse.com
|
| "Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
| news:%2****************@TK2MSFTNGP11.phx.gbl...
| >
| > "Franz" <fr*******@i-hate-spam.com> wrote in message
| > news:ew**************@TK2MSFTNGP15.phx.gbl...
| > |
http://support.microsoft.com/?kbid=317109
| > |
| > | In this document, the NAR method for C# is as follow.
| > |
| > | private void NAR(object o)
| > | {
| > | try
| > | {
| > | System.Runtime.InteropServices.Marshal.ReleaseComO bject(o);
| > | }
| > | catch {}
| > | finally
| > | {
| > | o = null;
| > | }
| > | }
| > |
| > | What is the use of the line "o = null"? Since the parameter is not a
| > ref
| > | object, it can't change the value of o. Is it a COM issue?
| > |
| > |
| >
| > The argument o is a copy of the callers object reference, so here the
| > value
| > of the copy is set to null. While it's not an error to do so, it's also
| > not
| > necessary as it will be done automatically at object return.
| >
| > Willy.
| >
| >
|
|