Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Unmanaged code calls my functions. In first function I sould pass back pointer to my managet object. Sometimes later some of my othrer functions got called with that same pointer as one of parameters . I sould dereference it use it to perform some calculations and then if it is not neaded dispose of it.
To cut the story short I need to pin that object so that GC won't move it til I dispose of it. How to do that in C# ?
Thanks in advance.
Posted

1 solution

Use the fixed[^] statement
 
Share this answer
 
Comments
Manfred Rudolf Bihy 31-Jul-11 15:41pm    
Good answer! 5+

Thanks for this great link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900