Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 32ef5d9

Browse files
committed
Merge pull request #3026 from Dmitry-Me/clarifyKeepAliveUsage1
No need to stick to end of method
2 parents 6a30ce4 + 8fcc0bf commit 32ef5d9

File tree

1 file changed

+6
-3
lines changed
  • src/mscorlib/src/System

1 file changed

+6
-3
lines changed

src/mscorlib/src/System/GC.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,12 @@ internal static int CollectionCount (int generation, bool getSpecialGCCount)
270270
// thread. This isn't just about handles - it can happen with just
271271
// about any finalizable resource.
272272
//
273-
// Users should insert a call to this method near the end of a
274-
// method where they must keep an object alive for the duration of that
275-
// method, up until this method is called. Here is an example:
273+
// Users should insert a call to this method right after the last line
274+
// of their code where their code still needs the object to be kept alive.
275+
// The object which reference is passed into this method will not
276+
// be eligible for collection until the call to this method happens.
277+
// Once the call to this method has happened the object may immediately
278+
// become eligible for collection. Here is an example:
276279
//
277280
// "...all you really need is one object with a Finalize method, and a
278281
// second object with a Close/Dispose/Done method. Such as the following

0 commit comments

Comments
 (0)