Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Thu Sep 23 16:58:59 UTC 2021
On Thursday, 23 September 2021 at 15:56:16 UTC, Steven
Schveighoffer wrote:
> See more details:
>
> https://docs.microsoft.com/en-us/dotnet/api/system.gc.keepalive?view=net-5.0#remarks
"
This method references the obj parameter, making that object
ineligible for garbage collection from the start of the routine
to the point, in execution order, where this method is called.
Code this method at the end, not the beginning, of the range of
instructions where obj must be available.
"
**Code this method at the end...**
:)
it is the same as proposed by jfondren simple
writeln(stopper.sg0.number) in the end of main, right?
More information about the Digitalmars-d-learn
mailing list